Skip to content

V3: Shape layers - #168

Merged
git-chad merged 46 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-shape-layers
Oct 1, 2026
Merged

git-chad merged 46 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-shape-layers

Conversation

@git-chad

Copy link
Copy Markdown
Collaborator

Adds a Shape source layer (roadmap 2.7, first stage): a flat-color silhouette with seven procedural presets, Ellipse, Rectangle (Corner Radius), Triangle, Polygon (Sides), Star (Points, Inner Radius), Ring (Thickness) and Blades (Blades, Twist, Blade Width, Hub), plus Color, Outline (edge only when above 0) and Softness (antialiased at 0). Center, Size and Rotation use the same centered composition units as layer masks, and the canvas handles are shared with masks: center moves, the X handle rotates and sets width, the Y handle sets height, one drag is one undo step, Escape cancels. Only the controls relevant to the chosen shape are shown.

All shapes are signed-distance fields evaluated in one shader and selected by a uniform, so switching shapes never recompiles. Coverage is emitted as straight alpha with the source role, so blend modes over photography work as in the Lovedance reference (Blades plus Multiply or Screen over a photo gives the poster's double exposure). Shapes accept layer masks and groups like any source. Editor and runtime passes are byte-identical apart from import paths. No pen tool or Bézier editing; the brush still paints mask coverage, not paths.

References 01 and 20 were reopened; the Blades preset is an interpretation of the pinwheel, not a reproduction. Default color, size and the Blades curve are open to the user's choice.

Validation:

  • bun run check — passes; the same three preexisting lint warnings.
  • bun run test:composition — full suite passes, including 97 new editor/runtime GPU cases in tests/composition/shape-layers.mjs: every shape, rotation, offset, corner radius, polygon sides, star tips and valleys, ring hole, blade gaps, outline, softness, color and multiply blending, then a masked multiplied Blades project through hydration, history, duplication, save/reopen, export and runtime pixel parity. Legacy baselines untouched.
  • bun tests/composition/shape-layers-ui.mjs — actual editor: handles drag/rotate with one-undo-per-drag, shape select with conditional controls, picker entry, save/reopen. layer-masks-ui.mjs passes after the shared-handles refactor.
  • Browser GPU tests use SwiftShader; this is not native performance validation.

Not in this slice: using a Shape layer as another layer's mask (decision pending from 1.4/2.7), SVG import. Stacked on #167 (git-chad/v3-stable-artboard), within integration #150. Nothing merges to main before V3 is complete. Focused user test: tests/composition/SHAPE-LAYERS-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: 4/5

The PR is not yet safe to merge because shared shape and mask handle drags can terminate and revert after their first store update.

Summary

This PR adds procedural Shape source layers across the editor and runtime, including seven SDF presets, parameter controls, shared canvas geometry handles, persistence/export support, and GPU/UI validation.

  • Adds matching editor and runtime Shape passes.
  • Registers Shape layers with the picker, catalog, project model, renderer, and shader export.
  • Refactors mask handles into shared geometry-handle infrastructure.
  • Adds rendering, persistence, parity, and actual-editor interaction tests.

Reviews (1) · Last reviewed commit: "Add Shape source layers with shared canv..."

Comment thread src/components/editor/geometry-handles.tsx
Comment thread src/renderer/shape-pass.ts
Comment thread src/lib/editor/shader-export.ts
Comment thread tests/composition/shape-layers-ui.mjs
…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.
Create the .context artifact directory up front and pick the history shortcut modifier from the platform.
Importing a project now disarms the armed remix draft and clears the remix origin alongside the active draft, so later edits cannot autosave under the previous remix title.
…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
@git-chad
git-chad force-pushed the git-chad/v3-stable-artboard branch from 949228c to 9058815 Compare October 1, 2026 07:04
@git-chad
git-chad force-pushed the git-chad/v3-shape-layers branch from d9684d7 to 33e78c0 Compare October 1, 2026 07:04
@git-chad
git-chad changed the base branch from git-chad/v3-stable-artboard to git-chad/shader-lab-v3-plan October 1, 2026 15:13
@git-chad
git-chad merged commit 33e78c0 into git-chad/shader-lab-v3-plan Oct 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 33e78c01 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