Post-processing: bloom, ambient occlusion, colour grading, FXAA #10

Merged
dev merged 6 commits from devin/1796106677-postfx into main 2026-12-01 08:35:35 -05:00
Owner

Adds a post-processing chain to the viewport, pop-out window and final renders (src/render/PostFx.{h,cpp}).

  • Bloom: soft-knee luminance threshold, quarter-res separable Gaussian.
  • Ambient occlusion: half-res SSAO from the depth buffer (normals from depth derivatives), fades with distance.
  • Colour grading: filmic (ACES fit) tone mapping, exposure, contrast, saturation, temperature, vignette.
  • Anti-aliasing: FXAA.

Design: one PostChain per output camera, selected by node masks (kMainViewMask, kPopViewMask, kRenderViewMask). With every effect off the chain draws the scene directly, so there is no cost by default. When active, a nested FBO camera renders the scene (float colour if supported) with the output camera's view and a projection whose near/far is re-fitted to the scene each cull (the output cameras use fixed 0.1/1000, which clipped scaled stages' sky domes). All shaders are GLSL 1.20.

Also: Look panel sections + presets (Anime: bloom/FXAA; Studio: bloom/AO/filmic/FXAA/vignette), .mrscene persistence (optional keys), CLI --bloom S --ao on|off --fxaa on|off --filmic on|off, grid gets an explicit vertex-colour shader and no depth writes.

Tested: Linux + Mac builds and mr_tests; screenshots of each effect on Miku and Karin+WinterWorld (Linux) and winter-raver2 (Mac); final PNG render with effects on Linux. Mac frame time (winter-raver2): off 36 ms, filmic only 40, FXAA 41, bloom 42, AO 46, all 49. Not tested: Windows build, pop-out window with effects on the Mac.

Adds a post-processing chain to the viewport, pop-out window and final renders (`src/render/PostFx.{h,cpp}`). - **Bloom**: soft-knee luminance threshold, quarter-res separable Gaussian. - **Ambient occlusion**: half-res SSAO from the depth buffer (normals from depth derivatives), fades with distance. - **Colour grading**: filmic (ACES fit) tone mapping, exposure, contrast, saturation, temperature, vignette. - **Anti-aliasing**: FXAA. Design: one `PostChain` per output camera, selected by node masks (`kMainViewMask`, `kPopViewMask`, `kRenderViewMask`). With every effect off the chain draws the scene directly, so there is no cost by default. When active, a nested FBO camera renders the scene (float colour if supported) with the output camera's view and a projection whose near/far is re-fitted to the scene each cull (the output cameras use fixed 0.1/1000, which clipped scaled stages' sky domes). All shaders are GLSL 1.20. Also: Look panel sections + presets (Anime: bloom/FXAA; Studio: bloom/AO/filmic/FXAA/vignette), `.mrscene` persistence (optional keys), CLI `--bloom S --ao on|off --fxaa on|off --filmic on|off`, grid gets an explicit vertex-colour shader and no depth writes. Tested: Linux + Mac builds and `mr_tests`; screenshots of each effect on Miku and Karin+WinterWorld (Linux) and winter-raver2 (Mac); final PNG render with effects on Linux. Mac frame time (winter-raver2): off 36 ms, filmic only 40, FXAA 41, bloom 42, AO 46, all 49. Not tested: Windows build, pop-out window with effects on the Mac.
dev added 5 commits 2026-12-01 01:49:17 -05:00
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
dev added 1 commit 2026-12-01 02:03:59 -05:00
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
dev merged commit 73834b8c70 into main 2026-12-01 08:35:35 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dev/3d-model-renderer#10