Skip to content

Add ssao_post post-process effect with WebGL2 shader and Canvas2D fallback#262

Open
smcga wants to merge 1 commit intomainfrom
codex/add-ssao-post-process-effect
Open

Add ssao_post post-process effect with WebGL2 shader and Canvas2D fallback#262
smcga wants to merge 1 commit intomainfrom
codex/add-ssao-post-process-effect

Conversation

@smcga
Copy link
Copy Markdown
Owner

@smcga smcga commented Apr 4, 2026

Motivation

  • Add a subtle Screen-Space Ambient Occlusion (SSAO-style) post-process effect that can be applied as a layer/overlay to the composited frame.
  • Prefer a single-pass WebGL2 shader for speed/quality and provide a performant Canvas2D fallback for environments with no WebGL2 or on low-power devices.
  • Integrate into the existing effect registry, debug controls, and documentation so it appears in the editor and docs generator.

Description

  • Implemented a WebGL2 single-pass SSAO-like shader that samples neighboring luminance and uses simple gradient edge boosting; file: src/renderer/effects/gl/ssaoPostEffect.ts.
  • Implemented a Canvas2D fallback with luminance sampling, edge cueing and a stride-based half-res optimization for performance; file: src/renderer/effects/ssaoPostCanvas.ts and helpers in src/renderer/effects/ssaoPostCanvas.test.ts.
  • Added an effect wrapper that chooses WebGL when available and falls back to Canvas2D, and exposed safe defaults + mobile-aware downscaling; file: src/renderer/effects/ssaoPostEffect.ts and exported SSAO_POST_DEFAULTS.
  • Registered the effect manifest and integrated it into the generated manifests/registry and debug controls, updated renderer layering so post-process layers sample the composited scene first, and updated README/docs: src/renderer/effects/manifest/ssao_post.manifest.ts, src/renderer/effects/manifest/generated.ts, src/renderer/renderer.ts, README.md, and regenerated docs/effects.md.
  • Minor test/doc housekeeping: added unit tests for luminance and AO clamp helpers, and updated the release timeline test optional-effects list to include ssao_post.

Testing

  • Ran docs generation with npm run docs:effects which regenerated docs/effects.md and updated the effect catalog successfully. (succeeded)
  • Ran the docs check with npm run docs:check which passed. (succeeded)
  • Added unit tests src/renderer/effects/ssaoPostCanvas.test.ts (luminance and AO clamp) and ran the test suite excluding an unreachable external integration test; npx vitest run --exclude api/kv.integration.test.ts passed all tests locally. (succeeded)
  • npm test in this environment initially reported a failing integration test api/kv.integration.test.ts due to network ENETUNREACH (external DB unreachable), and an unrelated release-timeline assertion which was updated in this change and then re-run; the functional changes to effects and renderer passed the automated tests when integration tests are excluded. (integration test failure is environmental)

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:05am

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