Skip to content

V3: Gradient Map effect layer - #166

Merged
git-chad merged 38 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-gradient-map
Oct 1, 2026
Merged

git-chad merged 38 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-gradient-map

Conversation

@git-chad

Copy link
Copy Markdown
Collaborator

Adds a Gradient Map effect layer (roadmap 2.5.2): a reorderable recolor-by-tone effect with an editable ramp, so tonal mapping can be scoped by groups and the new layer masks instead of applying globally. The global Scene → Color Map and existing projects are unchanged. It is listed in Core after Threshold, with a catalog preview rendered by the test harness.

Controls: a Preset select (Thermal, Duotone, Sepia, Neon, Grayscale; editing the ramp shows Custom), the shared GradientRamp editor (2–5 stops, click to add, double-click to remove), Amount and Invert. Stops persist as a compact JSON parameter that is parsed defensively (invalid input falls back to Thermal) and is hidden from the generic parameter list. Preset values are open to the user's choice.

Rendering: the LUT evaluation code moved into a shared renderer/color-map-lut.ts (pure, byte-identical in the runtime package); the global Color Map keeps its byte LUT and behavior. The layer samples a 256-entry float LUT stored in linear space by Rec.709 luminance of the input, sRGB-encoded so mid-gray lands at the ramp center (linear luminance crowded the Thermal ramp into blue/green, see the before/after previews). Output preserves input coverage like other color effects; Amount mixes toward the original. Reference 18 was reopened for the Thermal direction; it is a tonal palette, not depth.

Validation:

  • bun run check — passes; the same three preexisting lint warnings.
  • bun run test:composition — full suite passes, including 47 new editor/runtime GPU cases in tests/composition/gradient-map.mjs: stop parsing/serialization, presets, custom stops, Amount, Invert, alpha preservation, a grouped project where only the masked region is recolored while an external layer stays identical, hydration, history, duplication, save/reopen, shader export and runtime pixel parity. Legacy baselines untouched.
  • bun tests/composition/gradient-map-ui.mjs — actual editor: ramp section, preset switch, adding a stop turns Custom, one-undo-per-edit, picker entry, save/reopen.
  • Browser GPU tests use SwiftShader; this is not native performance validation.

Not in this slice: animatable ramp stops (Amount and Invert are animatable). Stacked on #165 (git-chad/v3-layer-masks), within integration #150. Nothing merges to main before V3 is complete. Focused user test: tests/composition/GRADIENT-MAP-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 appears safe to merge after considering one non-blocking stop-count consistency issue.

Summary

Adds a Gradient Map effect layer across the editor and portable runtime.

  • Introduces shared gradient-stop parsing and byte/linear LUT generation.
  • Adds presets, ramp editing, Amount, Invert, catalog integration, persistence, masks, and shader export.
  • Adds editor/runtime GPU, UI, persistence, and parity coverage.

Reviews (1) · Last reviewed commit: "Add a Gradient Map effect layer with an ..."

Comment thread src/renderer/color-map-lut.ts
@git-chad

Copy link
Copy Markdown
Collaborator Author

Follow-up pushed: ramp stops keep their authored order while dragging (a stop can pass another without both moving), and one ramp drag is one undo step. Covered by the UI test.

…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.
@git-chad
git-chad force-pushed the git-chad/v3-layer-masks branch from 79ea3a6 to 3573157 Compare October 1, 2026 07:04
@git-chad
git-chad force-pushed the git-chad/v3-gradient-map branch from 60506af to 60d45d6 Compare October 1, 2026 07:04
@git-chad
git-chad changed the base branch from git-chad/v3-layer-masks to git-chad/shader-lab-v3-plan October 1, 2026 15:13
@git-chad
git-chad merged commit 60d45d6 into git-chad/shader-lab-v3-plan Oct 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 60d45d67 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