Screen-Space Global Illumination
Approximates one-bounce diffuse indirect light by sampling the lit depth buffer around each pixel as if each visible sample were a small light, with the same sampling doubling as directional occlusion.
Also known as SSGI, SSDO, screen-space directional occlusion
In the family Light transport & global illumination, screen-space GI
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Official add-on | import { ssgi } from 'three/addons/tsl/display/SSGINode.js' docs WebGPURenderer / TSL. |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | Built in | Environment.ssil_enabled = true docs SSIL; Forward+ only. |
| Unity | Built in | Volume > Add Override > Lighting > Screen Space Global Illumination docs HDRP only. URP has no SSGI in Unity 6.3. |
| Unreal 5.7 | Built in | Post Process Volume > Global Illumination > Method = Screen Space docs |
| Blender 5.2 | Built in | Properties > Render > Raytracing (enable) > Method = Screen-Trace; Fast GI Approximation docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Screen-space directional occlusion extends ambient occlusion: for each pixel, instead of just counting occluded samples, it takes a set of directions in the hemisphere (via sample offsets within a screen-space radius). Samples whose reconstructed 3D position lies above the surface are considered unoccluded and contribute environment light; samples that lie below the surface are occluders.
For the indirect bounce, each occluding sample's lit colour (read from the previous frame's frame buffer) is treated as a small diffuse patch emitting towards the receiver. The contribution is weighted by form-factor-like terms: the cosine at the receiver, the cosine at the emitter, and the squared distance. The sum approximates one bounce of colour bleeding from visible surfaces.
Current variants use ray-marched screen-space traces of the depth buffer (hierarchical depth) with a few rays per pixel, feed history through temporal reprojection, and denoise with a spatial filter. The technique only sees what is on screen, so it is often combined with a world-space probe or Dynamic Diffuse Global Illumination (DDGI) fallback for off-screen light.
When to choose it
Reach for it when
- want cheap colour bleeding in deferred rendering
- indirect shadowing at contact scale is missing
- need one-bounce diffuse light without probes everywhere
- extra indirect detail on top of baked lighting
Choose it as an inexpensive extra for colour bleeding and indirect shadowing at contact scale in a deferred renderer, typically layered on top of probes or lightmaps.
Prefer Dynamic Diffuse Global Illumination (DDGI), SDF-Based Software Ray Tracing GI (Lumen-style) or Surfel-Based Global Illumination (GIBS) when off-screen light and consistent GI at any view angle matter. Prefer Radiance Cascades for screen-space-based tracing that avoids the noise of per-pixel gather. Prefer Reflective Shadow Maps when the emitter surfaces are known from a light's point of view.
Field marks
- Missing light from anything off-screen or hidden behind foreground objects, so indirect light pops when the source leaves the view
- Ghosting and smearing from temporal reuse on fast motion and disocclusion
- Thin-object problem: depth buffer lacks thickness, so occluders are misjudged and halos appear
- Colour bleeding vanishes at screen edges and when the camera turns
Presets
Screen-space GI — split direct lighting vs horizon-marching diffuse color bleed
{
"P_GI_INTENSITY": 1.35,
"P_SAMPLE_RADIUS": 0.9,
"P_BOUNCE_SAT": 1.2,
"P_SPLIT": 0.42
}Show GLSL (156 lines)
const float P_GI_INTENSITY = 1.35; // P GI Strength [0.0, 2.5, 0.05]
const float P_SAMPLE_RADIUS = 0.9; // P Gather Radius [0.2, 2.0, 0.05]
const float P_BOUNCE_SAT = 1.2; // P Color Bleed [0.2, 2.0, 0.05]
const float P_SPLIT = 0.42; // P Direct/GI Split [0.0, 1.0, 0.02]
float sdBox(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
// Cornell gallery box with crimson left wall, teal right wall, white central column & orb
vec2 mapRoom(vec3 p) {
// Inverted room walls: x in [-1.5,1.5], y in [-1.0,1.0], z in [-1.5, 3.0]
vec2 res = vec2(1.0 + p.y, 1.0); // floor
float ceilD = 1.0 - p.y; if (ceilD < res.x) res = vec2(ceilD, 1.0);
float backD = 1.45 + p.z; if (backD < res.x) res = vec2(backD, 1.0);
float leftD = 1.45 + p.x; if (leftD < res.x) res = vec2(leftD, 2.0); // crimson wall
float rightD = 1.45 - p.x; if (rightD < res.x) res = vec2(rightD, 3.0); // emerald-teal wall
// Central sculpted white pedestal & floating matte sphere
float dPed = sdBox(p - vec3(0.0, -0.55, -0.25), vec3(0.36, 0.45, 0.36)) - 0.03;
if (dPed < res.x) res = vec2(dPed, 4.0);
vec3 spPos = vec3(0.28 * sin(iTime * 0.7), 0.18 + 0.08 * cos(iTime * 1.1), -0.22);
float dSph = length(p - spPos) - 0.34;
if (dSph < res.x) res = vec2(dSph, 4.0);
// Side accent block near crimson wall
float dBlk = sdBox(p - vec3(-0.78, -0.68, -0.62), vec3(0.32, 0.32, 0.32)) - 0.02;
if (dBlk < res.x) res = vec2(dBlk, 4.0);
return res;
}
vec3 calcNormal(vec3 p) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapRoom(p + e.xyy).x - mapRoom(p - e.xyy).x,
mapRoom(p + e.yxy).x - mapRoom(p - e.yxy).x,
mapRoom(p + e.yyx).x - mapRoom(p - e.yyx).x
));
}
vec3 getAlbedo(float id, float sat) {
vec3 c;
if (id < 1.5) c = vec3(0.76, 0.76, 0.74);
else if (id < 2.5) c = vec3(0.88, 0.14, 0.12);
else if (id < 3.5) c = vec3(0.10, 0.76, 0.56);
else c = vec3(0.88, 0.87, 0.85);
float l = dot(c, vec3(0.299, 0.587, 0.114));
return clamp(mix(vec3(l), c, sat), 0.02, 1.0);
}
float softShadow(vec3 ro, vec3 rd, float maxT) {
float res = 1.0;
float t = 0.04;
for (int i = 0; i < 20; i++) {
float h = mapRoom(ro + rd * t).x;
res = min(res, clamp(5.0 * h / t, 0.0, 1.0));
t += max(h, 0.05);
if (t > maxT || res < 0.02) break;
}
return res;
}
vec3 directShade(vec3 p, vec3 n, float matId, vec3 lPos, float sat) {
vec3 toL = lPos - p;
float dist = length(toL) + 1e-4;
vec3 lDir = toL / dist;
float ndl = max(dot(n, lDir), 0.0);
float sh = softShadow(p + n * 0.015, lDir, dist - 0.08);
float att = 2.6 / (0.4 + dist * dist);
vec3 alb = getAlbedo(matId, sat);
return alb * vec3(1.15, 1.08, 0.96) * ndl * sh * att;
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec2 screenUV = fragCoord / iResolution.xy;
vec3 ro = vec3(0.0, 0.05, 2.35);
vec3 rd = normalize(vec3(uv, -1.32));
float sat = clamp(P_BOUNCE_SAT, 0.2, 2.2);
vec3 lPos = vec3(0.45 * cos(iTime * 0.55), 0.88, -0.2 + 0.35 * sin(iTime * 0.55));
float t = 0.0;
float matId = 1.0;
bool hit = false;
for (int i = 0; i < 64; i++) {
vec2 h = mapRoom(ro + rd * t);
if (h.x < 0.002) { matId = h.y; hit = true; break; }
t += h.x;
if (t > 9.0) break;
}
vec3 col = vec3(0.02);
if (hit) {
vec3 p = ro + rd * t;
vec3 n = calcNormal(p);
vec3 alb = getAlbedo(matId, sat);
vec3 direct = directShade(p, n, matId, lPos, sat);
// Ceiling area light emitter plaque
float emitter = smoothstep(0.32, 0.18, length(p.xz - lPos.xz)) * smoothstep(0.95, 0.99, p.y);
direct += vec3(3.4, 3.1, 2.6) * emitter;
// Screen-Space GI gather: march 8 azimuthal horizon rays around surface tangent plane
vec3 tangent = normalize(abs(n.y) < 0.9 ? cross(n, vec3(0.0, 1.0, 0.0)) : cross(n, vec3(1.0, 0.0, 0.0)));
vec3 bitan = cross(n, tangent);
float rad = clamp(P_SAMPLE_RADIUS, 0.2, 2.2);
float jitter = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);
vec3 giAccum = vec3(0.0);
float aoAccum = 0.0;
for (int k = 0; k < 8; k++) {
float ang = (float(k) + jitter * 0.45) * 0.785398;
vec3 gDir = normalize(n * 0.55 + (cos(ang) * tangent + sin(ang) * bitan) * 0.835);
// Short horizon march in scene proxy (emulates screen-space depth buffer marching)
float gt = 0.08;
for (int s = 0; s < 6; s++) {
vec3 gp = p + n * 0.02 + gDir * gt;
vec2 gh = mapRoom(gp);
if (gh.x < 0.06 || gt > rad * 1.45) {
vec3 gn = calcNormal(gp);
// Sample direct radiance of nearby hit surface for 1-bounce color bleed
vec3 sampleRad = directShade(gp, gn, gh.y, lPos, sat) + getAlbedo(gh.y, sat) * 0.18;
float cosW = max(dot(n, gDir), 0.0);
float distW = 1.0 / (0.35 + gt * gt * 1.4);
giAccum += sampleRad * cosW * distW;
aoAccum += smoothstep(rad * 1.4, 0.05, gt);
break;
}
gt += max(gh.x, rad * 0.22);
}
}
giAccum /= 8.0;
float ssao = 1.0 - 0.52 * (aoAccum / 8.0);
vec3 directOnly = direct + alb * vec3(0.045, 0.048, 0.058);
vec3 withSSGI = direct + alb * (giAccum * max(P_GI_INTENSITY, 0.0) * 1.65 + vec3(0.04, 0.045, 0.055) * ssao);
float splitX = clamp(P_SPLIT, 0.0, 1.0);
col = (screenUV.x < splitX) ? directOnly : withSSGI;
if (splitX > 0.01 && splitX < 0.99 && abs(screenUV.x - splitX) < 0.004) {
col = vec3(1.8, 1.5, 0.7);
}
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| screen-space-gi-live | Tesla T4 1920x1080 | 244× baseline (extreme) · 8.04 ms / 8.22 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| screen-space-gi-live | NVIDIA L4 1920x1080 | 232× baseline (extreme) · 3.70 ms / 3.76 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| screen-space-gi-live | NVIDIA A100-SXM4-40GB 1920x1080 | 149× baseline (extreme) · 4.28 ms / 4.32 ms · 1.9× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Horizon-Based Ambient Occlusion, Reflective Shadow Maps, Instant Radiosity (Virtual Point Lights), Screen-Space Ambient Occlusion, Shadow Mapping; cited by Alchemy screen-space ambient obscurance, Light Propagation Volumes, Neural Radiance Caching, Visibility Bitmask Ambient Occlusion.
Crosses
- Bounce light inside a photograph: Drop a virtual lamp into a single photo and get coloured bounce light and occlusion from the photo's own surfaces. One network supplies the G-buffer, and the photo's pixels act as the radiance buffer that screen-space GI gathers from.
- Dynamic Diffuse Global Illumination (DDGI): Probes supply off-screen and low-frequency light that the screen-space gather cannot see.
Sources
- primaryTobias Ritschel, Thorsten Grosch, Hans-Peter Seidel (2009). Approximating dynamic global illumination in image space. Proceedings of the 2009 symposium on Interactive 3D graphics and games.Verified via crossref · 2026-11-29doi:10.1145/1507149.1507161