Add G-buffer feasibility analysis for SSAO and SSR#15
Draft
Add G-buffer feasibility analysis for SSAO and SSR#15
Conversation
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
This reverts commit 3db5a7d.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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