Skip to content

Add G-buffer feasibility analysis for SSAO and SSR#15

Draft
motorsep wants to merge 6 commits intomasterfrom
claude/analyze-gbuffer-feasibility-escPX
Draft

Add G-buffer feasibility analysis for SSAO and SSR#15
motorsep wants to merge 6 commits intomasterfrom
claude/analyze-gbuffer-feasibility-escPX

Conversation

@motorsep
Copy link
Copy Markdown
Owner

Comprehensive analysis of the engine's rendering pipeline, shaders, and framebuffer infrastructure to determine if a slim G-buffer can be added without overhauling the renderer design. Conclusion: feasible via extending the existing depth pre-pass with MRT normal output.

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ

Comprehensive analysis of the engine's rendering pipeline, shaders,
and framebuffer infrastructure to determine if a slim G-buffer can be
added without overhauling the renderer design. Conclusion: feasible
via extending the existing depth pre-pass with MRT normal output.

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ
Implements performant screen-space ambient occlusion and screen-space
reflections for the forward rendering pipeline, requiring only the
depth buffer (no G-buffer needed).

SSAO: HBAO-style algorithm with 8 directions x 4 steps, bilateral
blur, depth-reconstructed normals, and multiplicative scene compositing.

SSR: Linear ray march with binary search refinement, Fresnel-based
reflection strength, edge/distance fading, and premultiplied alpha
compositing.

New CVars: r_useSSAO, r_ssaoRadius, r_ssaoIntensity, r_ssaoBias,
r_useSSR, r_ssrMaxDistance, r_ssrStride, r_ssrIntensity.

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ
CMake 4.x removed compatibility with versions below 3.5. Bump all
cmake_minimum_required calls from 2.4.4/2.8/3.0/3.4 to 3.5 so the
project configures correctly on modern CMake (tested with 4.1.0).

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ
Instead of each shader computing linear depth from the hardware depth
buffer using the projection matrix, add a dedicated linearize-depth
pass that writes to an RGBA16F texture. SSAO and SSR shaders now read
pre-linearized depth directly, removing the dependency on
rpProjectionMatrix vertex params and simplifying the depth
reconstruction to a single texture fetch. The projection matrix
diagonal is passed via rpUser2 for view-space position reconstruction.

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ
The linearizeDepth shader used -d/(c+ndcZ) which produces negative
linear depth values. The correct formula is d/(c+ndcZ) which gives
positive depth matching the inkEffect shader's proven approach.
Negative depths caused SSAO to reconstruct wrong view positions and
normals (dark gradient bands), and SSR to fail entirely (rays going
behind the camera).

Also fix SSR binary search refinement where refT was computed as
(t - stepSize*0.5) + stepSize*0.5 = t (no-op), so the expected ray
depth never updated during refinement iterations.

https://claude.ai/code/session_01VdSEPfFdPX7fLLYN6x2ZfQ
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.

2 participants