Add Screen-Space Global Illumination (SSGI) with configurable quality tiers#287
Add Screen-Space Global Illumination (SSGI) with configurable quality tiers#287Noa3 wants to merge 1 commit intoComplementaryDevelopment:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds Screen-Space Global Illumination (SSGI) to the Complementary Shaders pack, providing an approximation of indirect diffuse lighting through screen-space ray marching. The implementation introduces configurable quality tiers and allows users to adjust the strength and radius of the global illumination effect.
Changes:
- Added SSGI implementation with 4 quality tiers (OFF, Low, Medium, High) using different ray and step counts
- Integrated SSGI into the deferred rendering pipeline after SSAO
- Added configuration options for SSGI quality, strength, and radius with profile-specific defaults
- Minor cleanup replacing manual distance calculation with built-in
length()function
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| shaders/lib/lighting/screenSpaceGI.glsl | New file implementing SSGI with cosine-weighted hemisphere sampling and depth-aware ray marching |
| shaders/program/deferred1.glsl | Integration of SSGI into deferred rendering pass with conditional compilation |
| shaders/lib/common.glsl | Added RT_SUNLIGHT_TRACING, RT_GI_STRENGTH, and RT_GI_RADIUS defines with SSGI_ENABLED conditional |
| shaders/shaders.properties | Added RT_SUNLIGHT_TRACING to profiles, created RT_LIGHTING_SETTINGS submenu, registered sliders |
| shaders/lang/en_US.lang | Added localization strings for SSGI settings and descriptions |
| shaders/lib/lighting/shadowSampling.glsl | Refactored distance calculation to use built-in length() function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| float xi2 = fract(dither * 1.414 + float(i) * 0.381966); | ||
|
|
||
| vec3 sampleDir = CosWeightedHemisphereDir(normalM, xi1, xi2); | ||
| vec3 viewDir = mat3(gbufferModelView) * sampleDir; |
There was a problem hiding this comment.
Coordinate space transformation error: sampleDir is already in view space after being generated by CosWeightedHemisphereDir (which works in the normal's tangent space), but line 55 incorrectly applies gbufferModelView again. Since normalM is already in view space (transformed at line 236 of deferred1.glsl), the hemisphere sampling produces view-space directions. Applying gbufferModelView again would transform from view space to... an undefined space. Line 55 should be removed, and sampleDir should be used directly as viewDir.
| vec3 viewDir = mat3(gbufferModelView) * sampleDir; | |
| vec3 viewDir = sampleDir; |
| #define SSAO_I 100 //[0 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 220 240 260 280 300] | ||
| #define VANILLAAO_I 100 //[0 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 220 240 260 280 300] | ||
|
|
||
| #define RT_SUNLIGHT_TRACING 0 //[0 1 2 3] |
There was a problem hiding this comment.
The define name RT_SUNLIGHT_TRACING is misleading for a Screen-Space Global Illumination feature. The setting doesn't trace sunlight specifically—it traces indirect diffuse lighting from all visible surfaces. Consider renaming to RT_GI_QUALITY, SSGI_QUALITY, or similar to accurately reflect what this setting controls. The same applies to RT_SUNLIGHT_QUALITY at line 493 of common.glsl.
| #define RT_SUNLIGHT_TRACING 0 //[0 1 2 3] | |
| #define RT_GI_QUALITY 0 //[0 1 2 3] | |
| #define RT_SUNLIGHT_TRACING RT_GI_QUALITY // Backwards compatibility: deprecated, use RT_GI_QUALITY |
i deleted the old fork because i fucked too much with it around, this is the backup and same changes as #286
Changes:
Adds a screen-space path tracing approximation for indirect diffuse lighting. Rays are marched in screen space from each fragment along cosine-weighted hemisphere directions to gather light bounces from nearby visible surfaces.
New option: RT_SUNLIGHT_TRACING
Core implementation (lib/lighting/screenSpaceGI.glsl)
Integration
Minor cleanup