Skip to content

V3: Annotations layer - #172

Merged
git-chad merged 58 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-annotations
Oct 1, 2026
Merged

git-chad merged 58 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-annotations

Conversation

@git-chad

Copy link
Copy Markdown
Collaborator

Part 2 of the technical annotations direction (roadmap 6.3): a standalone Annotations effect layer modeled on reference 03 (the frog), with the vocabulary of 10 and 19.

What it draws: a target with concentric solid and dashed rings, a reticle, a small offset ring with a cross, angle and value readouts and dashed connectors to nearby marks; scattered dots, rings, crosses, boxes (solid, dashed, corner brackets) with short labels and counters; rulers with ticks and a boxed counter; a status tag and two metadata blocks; a dithered gradient swatch. Every family has a toggle. Density, Seed and Drift (slow seeded motion over time, as on video) shape the scatter; Scale, Stroke Width and Text Size the look.

Placement: Seeded anywhere, along Edges (a 128×72 Sobel field read back every third frame; the target can Snap to Strongest Edge), or Painted with the same brush and coverage codec as masks and Cells, so marks appear only inside your strokes. The target has canvas handles (center and size) sharing the mask/shape handle component; one drag is one undo.

Text: Instrument, Surveillance, Scientific and Minimal presets fill two editable fields, Words (the first is the status tag) and Metadata (a blank line splits the two corner blocks). Glyphs use Blob Tracking's mono atlas. Color: Monochrome ink or a Palette ramp where each element picks a stop by seed. The panel states that nothing is detected or recognized.

Architecture: deterministic CPU layout in renderer/annotations-layout.ts (shared, at most 320 marks and 1024 glyphs) drawn as instanced signed-distance quads into a transparent target and composited as an effect, so it respects groups, masks and blend modes. Editor and runtime are identical apart from imports.

Validation:

  • bun run check — passes; the same three preexisting lint warnings.
  • bun run test:composition — full suite passes, including tests/composition/annotations.mjs: layout determinism, density, drift, target rings and snap, painted and edge placement, text and palette parsing, editor/runtime renders (marks present, everything-off empty, target position and offset, palette color, parity), brush eligibility, hydration, save/reopen, export, reopened pixels and the catalog preview. Legacy baselines untouched.
  • bun tests/composition/annotations-ui.mjs — actual editor: picker entry, target handle drag with one-undo, preset apply, palette ramp, painted placement with the brush, save/reopen. Screenshot reviewed against reference 03.

Found and fixed while building: a chain of nested TSL select calls keyed on a float instance attribute produced wrong coverage; arithmetic masks replaced it.

Not in this slice: connected-dots portrait (reference 21), region- or segmentation-guided placement, per-element rotation, the organic cracks of reference 03. Stacked on #170 (git-chad/v3-blob-tracking-upgrade), within integration #150. Nothing merges to main before V3 is complete. Focused user test: tests/composition/ANNOTATIONS-MANUAL-QA.md.

@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shader-lab Ready Ready Preview Oct 1, 2026 7:06am UTC

@greptile-apps

greptile-apps Bot commented Sep 21, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

The PR is not yet safe to merge because fresh edge-guided exports can render random placement and painted annotations can drift outside the selected area.

Summary

This PR adds a standalone Annotations effect across the editor and package runtime, including deterministic layout, instanced rendering, edge- and paint-guided placement, target handles, presets, palette controls, persistence, export, and composition tests.

  • Edge-guided exports need to wait for their asynchronous Sobel readback.
  • Painted drift must remain constrained to the painted area.
  • Snapped targets need handle behavior consistent with their rendered position.
  • The shader-export type union should match the newly supported runtime type.

Reviews (1) · Last reviewed commit: "Add an Annotations layer with seeded, ed..."

Comment thread src/renderer/annotations-layout.ts Outdated
Comment thread src/renderer/annotations-pass.ts
Comment thread src/components/editor/annotation-handles-overlay.tsx
Comment thread src/lib/editor/shader-export.ts
…roup failures

Media load callbacks now ignore replaced or removed passes and pending loads are cleared on disposal. Strict-mode pass failures are reported once at the originating pass instead of at every group boundary.
Publishing now drops every descendant of a hidden group and clears the
parentId of any retained layer (the audio source) whose parent was removed,
so the published scene passes hierarchy validation on reopen.
Cap the neighbor row and column search to two cells each side so the
worst-case cellAt count per fragment is 25 instead of unbounded in the
packed minimum-size, maximum-stroke configuration. Mirrored in the
runtime package.
…e on buttons

Clear the active paint layer when the layer stops being paintable (selection,
mode, visibility or lock change) so Paint never resumes without Edit Paint.
Only preventDefault on Space for non-interactive targets so focused buttons
and links still activate.
…handle unmount

Mask coordinates are now measured against the composition crop frame in the
renderer and the handles overlay, so preview and export agree when the
viewport and composition aspect ratios differ.
Unmounting the handles mid-drag no longer writes the drag-start mask back,
which overwrote the result of an undo.
… imports

- Recompute outputSize from the restored scene config when applying a history snapshot
- Normalize Custom imports whose saved composition differs from the guide size, keeping fixed Custom documents intact
… UI test docs

- GeometryHandles: keep restore in a ref so rerenders during a drag no longer cancel it
- shape-pass (editor and runtime): atan2 returns +-PI on the negative axis when y is zero
- shader-export: add shape to SupportedShaderExportLayerType
- Document shape-layers-ui.mjs in SHAPE-LAYERS-MANUAL-QA.md
…th limit

- restore font size when a text handle resize is cancelled
- rotate the edit textarea around the anchor on both axes
- cap in-place text edits at the Text parameter's 600 characters
…bracket mode

Body: the trail ribbon now accumulates the corner-masked bracket stroke instead of the full outline, in both the app and the React runtime copy.
…ait edge readback on export, hide snapped handles, widen export type

- Painted placement falls back to the undrifted anchor when drift would leave the stroke
- Edge placement lays out nothing until the edge field exists and the export prepare step awaits the pending readback
- Annotation target handles are hidden while Snap to Strongest Edge is active
- Add annotations to SupportedShaderExportLayerType
@git-chad
git-chad force-pushed the git-chad/v3-blob-tracking-upgrade branch from df1a627 to ffb8e48 Compare October 1, 2026 07:05
@git-chad
git-chad force-pushed the git-chad/v3-annotations branch from 8520b7f to d258666 Compare October 1, 2026 07:05
@git-chad
git-chad changed the base branch from git-chad/v3-blob-tracking-upgrade to git-chad/shader-lab-v3-plan October 1, 2026 15:13
@git-chad
git-chad merged commit d258666 into git-chad/shader-lab-v3-plan Oct 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — d2586666 Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant