---
id: "screen-space-gi"
title: "Screen-Space Global Illumination"
aliases: [SSGI, SSDO, screen-space directional occlusion]
domain: "gi"
stage: "lighting"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2009
inputs: [gbuffer, depth, normals, radiance]
outputs: [radiance]
style: "photoreal"
dynamic: "dynamic"
cost: "medium"
authority: "Ritschel et al., 2009"
url: "https://texelatlas.vercel.app/t/screen-space-gi/"
sources_verified_at: "2026-11-29"
---
# Screen-Space Global Illumination (Ritschel et al., 2009)

> 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.

## 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

## 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 [ddgi](ddgi) fallback for off-screen light.

## When to use it

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 [ddgi](ddgi), [lumen-gi](lumen-gi) or [surfel-gi](surfel-gi) when off-screen light and consistent GI at any view angle matter. Prefer [radiance-cascades](radiance-cascades) for screen-space-based tracing that avoids the noise of per-pixel gather. Prefer [reflective-shadow-maps](reflective-shadow-maps) when the emitter surfaces are known from a light's point of view.

## Cost

medium — Cost scales with samples per pixel plus a denoise and temporal pass; commonly run at half resolution.
Measured GPU Weight: 244.24× baseline (extreme) — 8.0356 ms median / 8.218 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 232.43× baseline (extreme) — 3.6956 ms median (2.17× faster on L4).
Ampere A100 scaling: 148.76× baseline (extreme) — 4.2844 ms median (1.88× faster on A100).

## Failure modes

- 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

## Engine support

- blender: builtin — `Properties > Render > Raytracing (enable) > Method = Screen-Trace; Fast GI Approximation` (evidence: https://docs.blender.org/manual/en/5.2/render/eevee/render_settings/raytracing.html, checked 2026-12-01)
- godot: builtin — `Environment.ssil_enabled = true` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Environment.xml, checked 2026-12-01) — SSIL; Forward+ only.
- threejs: official — `import { ssgi } from 'three/addons/tsl/display/SSGINode.js'` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/tsl/display/SSGINode.js, checked 2026-12-01) — WebGPURenderer / TSL.
- unity: builtin — `Volume > Add Override > Lighting > Screen Space Global Illumination` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.high-definition/Documentation~/reference-screen-space-global-illumination.md, checked 2026-12-01) — HDRP only. URP has no SSGI in Unity 6.3.
- unreal: builtin — `Post Process Volume > Global Illumination > Method = Screen Space` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/post-process-effects-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: gbuffer, depth, normals, radiance
- Outputs: radiance
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot

## Presets

### Screen-space GI — split direct lighting vs horizon-marching diffuse color bleed (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_GI_INTENSITY": 1.35,
  "P_SAMPLE_RADIUS": 0.9,
  "P_BOUNCE_SAT": 1.2,
  "P_SPLIT": 0.42
}
```

```glsl
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).

## Combines with

- [Dynamic Diffuse Global Illumination (DDGI)](https://texelatlas.vercel.app/t/ddgi.md): Probes supply off-screen and low-frequency light that the screen-space gather cannot see.

## Combination ideas

- [Bounce light inside a photograph](https://texelatlas.vercel.app/ideas/photo-bounce-relighting/)

## Sources

1. [primary] Tobias 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. https://doi.org/10.1145/1507149.1507161 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Screen-Space Global Illumination." https://texelatlas.vercel.app/t/screen-space-gi/ (accessed 2026-12-01).
