Skip to content

Add chromaticAberration post-process effect and renderer sourceCanvas hook#261

Open
smcga wants to merge 2 commits intomainfrom
codex/add-chromaticaberration-post-process-effect
Open

Add chromaticAberration post-process effect and renderer sourceCanvas hook#261
smcga wants to merge 2 commits intomainfrom
codex/add-chromaticaberration-post-process-effect

Conversation

@smcga
Copy link
Copy Markdown
Owner

@smcga smcga commented Apr 4, 2026

Motivation

  • Provide a reusable screen-space post-process effect that can be applied as a section base or as a layer over existing visuals without redesigning the renderer.
  • Implement a robust Canvas2D MVP for chromatic aberration (with subtle defaults) and expose parameters for stylised/glitch usage and editor/debug control.
  • Add the smallest safe renderer extension so layer effects can read the previously rendered scene as an input source.

Description

  • Implemented chromaticAberration in src/renderer/effects/chromaticAberration.ts with exported CHROMATIC_ABERRATION_DEFAULTS, resolveChromaticAberrationParams, applyChromaticAberrationToData, and ChromaticAberrationEffect that samples an input canvas, offsets channels radially/directionally, supports sampleStep block rendering, and blends via alpha.
  • Added a manifest src/renderer/effects/manifest/chromaticAberration.manifest.ts and registered the effect in the generated manifest list so it appears in the registry and debug/editor dropdowns; provided debug controls and docs metadata (including mode select: rgb|rg|rb|gb).
  • Extended the effect context to accept an optional sourceCanvas?: HTMLCanvasElement (src/renderer/effects/types.ts) and wired Renderer.renderEffectTo / layer rendering to pass sceneCanvas as the sourceCanvas when rendering layers, so post effects can process prior composited imagery (src/renderer/renderer.ts).
  • Updated docs (docs/effects.md regenerated and README.md Effect catalog) to include the new effect and added unit tests src/renderer/effects/chromaticAberration.test.ts covering param clamping, centre stability, and sampleStep block behaviour; also updated the release timeline test optional list to include the new key.

Testing

  • Ran documentation generation and checks: npm run docs:effects (succeeded) and npm run docs:check (succeeded).
  • Ran focused unit tests: npx vitest run src/timeline/releaseTimeline.test.ts src/renderer/effects/effectCatalogDocs.test.ts src/renderer/effects/chromaticAberration.test.ts and all targeted tests passed.
  • Ran full test suite: npm test; all unit/core tests passed locally, with a single failing integration test (api/kv.integration.test.ts) that failed due to external network ENETUNREACH to Upstash in this environment and is unrelated to the effect.
  • Verified the effect appears in the registry, debug controls, and regenerated docs/effects.md (total effects increased accordingly).

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 4, 2026

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

Project Deployment Actions Updated (UTC)
codexperimental Ready Ready Preview, Comment Apr 4, 2026 2:29am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant