Dynamic Diffuse Global Illumination (DDGI)
A grid of light probes updated every frame with a few ray-traced samples each, storing octahedrally mapped irradiance and distance so lookups avoid light leaking. Gives dynamic diffuse GI with stable cost.
Also known as RTXGI probes, irradiance fields
In the family Light transport & global illumination, probe-based GI
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | Adaptive Probe Volumes are baked, not dynamically updated ray-traced probes. |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
A regular 3D grid of probes covers the scene. Each frame every probe fires a modest number of rays (tens to a couple hundred) with hardware ray tracing or another fast tracer. The ray hits are shaded with direct light plus the previous frame's probe lookups, so each frame effectively adds one more bounce.
Each probe stores two small octahedral maps: irradiance, and a mean and mean-squared distance to the nearest surface per direction. New results are blended into the old with a temporal hysteresis factor, so light changes propagate over a few frames but noise is averaged away.
At shading time the pixel interpolates the eight surrounding probes trilinearly. Weights are modulated by a normal-based term, a Chebyshev visibility test using the stored distance moments (a probe that cannot see the point contributes less), and a smooth-backface term. That visibility term is the main reason the technique avoids the bright leaking of earlier irradiance-volume systems.
When to choose it
Reach for it when
- dynamic global illumination without baking lightmaps
- indirect light must react to moving lights and objects
- light leaking and flicker in probe based gi
- diffuse bounce lighting on hardware ray tracing
Choose it for fully dynamic diffuse GI with predictable cost on ray-tracing-capable hardware, when low-frequency indirect light is enough and you want temporal stability rather than per-pixel noise.
Prefer SDF-Based Software Ray Tracing GI (Lumen-style) or Surfel-Based Global Illumination (GIBS) when you need finer spatial detail or large scenes without placing grids by hand. Prefer Radiance Cascades when you need sharper shadows from indirect light in screen-space or 2D. Prefer Irradiance Volumes and Light Probes or Lightmap Baking when everything is static or you target hardware without ray tracing. Prefer ReSTIR GI: Path Resampling for Real-Time Path Tracing for high-frequency per-pixel indirect.
Field marks
- Light leaking through thin walls when probes sit on the wrong side and the distance moments cannot separate them
- Slow response to lighting changes because of temporal hysteresis, visible as lag on moving lights
- Low spatial resolution: contact shadows and small-scale indirect detail are missing, so it is paired with SSAO or ray-traced AO
- Probe placement and cascade layout must be authored or streamed to cover large worlds, and probes inside geometry need classification
Presets
Dynamic Diffuse GI (DDGI) — trilinear irradiance probe lattice & Chebyshev visibility
{
"P_PROBE_SCALE": 1,
"P_GI_BOUNCE": 1.35,
"P_CHEBYSHEV": 0.88,
"P_SUN_SWEEP": 1
}Show GLSL (184 lines)
const float P_PROBE_SCALE = 1.0; // P Probe Spheres [0.0, 2.0, 0.05]
const float P_GI_BOUNCE = 1.35; // P Probe GI Gain [0.0, 2.5, 0.05]
const float P_CHEBYSHEV = 0.88; // P Leak Guard [0.0, 1.0, 0.02]
const float P_SUN_SWEEP = 1.0; // P Sun Sweep [0.0, 2.5, 0.05]
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);
}
// Room with central divider wall + vibrant colored bounce walls to demonstrate DDGI Chebyshev leak prevention
vec2 mapScene(vec3 p) {
vec2 res = vec2(1.05 + p.y, 1.0); // floor
float ceilD = 1.05 - p.y; if (ceilD < res.x) res = vec2(ceilD, 1.0);
float backD = 1.55 + p.z; if (backD < res.x) res = vec2(backD, 1.0);
float leftD = 1.55 + p.x; if (leftD < res.x) res = vec2(leftD, 2.0); // warm crimson wall
float rightD = 1.55 - p.x; if (rightD < res.x) res = vec2(rightD, 3.0); // azure blue wall
// Central thin divider baffle wall (classic DDGI light-leak test geometry)
float dWall = sdBox(p - vec3(-0.08, -0.35, -0.25), vec3(0.08, 0.72, 0.58));
if (dWall < res.x) res = vec2(dWall, 4.0);
// Foreground matte display block on right side
float dBlk = sdBox(p - vec3(0.72, -0.68, -0.15), vec3(0.32, 0.37, 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(
mapScene(p + e.xyy).x - mapScene(p - e.xyy).x,
mapScene(p + e.yxy).x - mapScene(p - e.yxy).x,
mapScene(p + e.yyx).x - mapScene(p - e.yyx).x
));
}
// Evaluate directional octahedral irradiance stored in a DDGI probe at world position probePos
vec3 evalProbeIrradiance(vec3 probePos, vec3 dir, vec3 sunPatch) {
// Analytical bounce contributions from red left wall, blue right wall, and moving sunlit floor patch
vec3 toLeft = normalize(vec3(-1.55, probePos.y, probePos.z) - probePos);
vec3 toRight = normalize(vec3(1.55, probePos.y, probePos.z) - probePos);
vec3 toPatch = sunPatch - probePos;
float patchDist = length(toPatch) + 1e-4;
vec3 patchDir = toPatch / patchDist;
float wLeft = pow(max(dot(dir, toLeft) * 0.5 + 0.5, 0.0), 1.8) / (0.65 + pow(probePos.x + 1.55, 2.0));
float wRight = pow(max(dot(dir, toRight) * 0.5 + 0.5, 0.0), 1.8) / (0.65 + pow(1.55 - probePos.x, 2.0));
float wPatch = pow(max(dot(dir, patchDir) * 0.5 + 0.5, 0.0), 2.2) / (0.35 + patchDist * patchDist);
// Baffle wall blocks cross-room probe bounce between left (x < -0.08) and right (x > -0.08)
float sameSidePatch = smoothstep(-0.2, 0.2, (probePos.x + 0.08) * (sunPatch.x + 0.08));
vec3 irr = vec3(0.05, 0.06, 0.08);
irr += vec3(1.35, 0.22, 0.14) * wLeft * (0.45 + 0.55 * step(probePos.x, 0.1));
irr += vec3(0.16, 0.48, 1.35) * wRight * (0.45 + 0.55 * step(-0.2, probePos.x));
irr += vec3(2.4, 1.85, 1.15) * wPatch * mix(0.25, 1.0, sameSidePatch);
return irr;
}
// Trilinear DDGI probe grid lookup with smooth-backface & Chebyshev distance-visibility weighting
vec3 sampleDDGIGrid(vec3 p, vec3 n, vec3 sunPatch, float chebStrength) {
vec3 spacing = vec3(0.95, 0.78, 0.95);
vec3 origin = vec3(-0.95, -0.58, -0.95);
vec3 gridCoord = (p - origin) / spacing;
vec3 baseCell = clamp(floor(gridCoord), vec3(0.0), vec3(1.0));
vec3 alpha = clamp(gridCoord - baseCell, 0.0, 1.0);
vec3 sumIrr = vec3(0.0);
float sumW = 0.0;
for (int i = 0; i < 8; i++) {
vec3 off = vec3(
mod(float(i), 2.0),
mod(floor(float(i) * 0.5), 2.0),
floor(float(i) * 0.25)
);
vec3 probePos = origin + (baseCell + off) * spacing;
vec3 trilin = mix(1.0 - alpha, alpha, off);
float w = trilin.x * trilin.y * trilin.z;
vec3 toProbe = probePos - p;
float dProbe = length(toProbe) + 1e-4;
vec3 dirToProbe = toProbe / dProbe;
// Smooth backface weight: ((dot(N, dirToProbe) + 1) / 2)^2
float wrap = 0.5 * dot(n, dirToProbe) + 0.5;
w *= wrap * wrap + 0.04;
// Chebyshev visibility test across baffle wall: attenuate probes on opposite side of divider
float midD = mapScene(0.5 * (p + probePos)).x;
float vis = smoothstep(-0.02, 0.12, midD);
w *= mix(1.0, max(vis, 0.02), chebStrength);
sumIrr += evalProbeIrradiance(probePos, n, sunPatch) * w;
sumW += w;
}
return sumIrr / max(sumW, 1e-4);
}
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;
vec3 ro = vec3(0.0, 0.14, 2.55);
vec3 rd = normalize(vec3(uv, -1.38));
float sweep = iTime * 0.65 * max(P_SUN_SWEEP, 0.0);
vec3 sunPatch = vec3(0.85 * sin(sweep), -0.95, -0.35 + 0.35 * cos(sweep * 0.8));
vec3 sunOrigin = vec3(sunPatch.x * 0.65, 0.98, 0.25);
// Raymarch room geometry
float t = 0.0;
float matId = 1.0;
bool hit = false;
for (int i = 0; i < 64; i++) {
vec2 h = mapScene(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 = vec3(0.78, 0.77, 0.75);
if (matId > 1.5 && matId < 2.5) alb = vec3(0.86, 0.18, 0.14);
else if (matId > 2.5 && matId < 3.5) alb = vec3(0.14, 0.44, 0.88);
// Direct spotlight sweeping across the room
vec3 toL = sunOrigin - p;
float dL = length(toL) + 1e-4;
vec3 lDir = toL / dL;
vec3 spotDir = normalize(sunPatch - sunOrigin);
float spot = smoothstep(0.62, 0.88, dot(-lDir, spotDir));
float sh = 1.0;
float ts = 0.04;
for (int s = 0; s < 18; s++) {
float dh = mapScene(p + n * 0.015 + lDir * ts).x;
sh = min(sh, clamp(6.0 * dh / ts, 0.0, 1.0));
ts += max(dh, 0.05);
if (ts > dL - 0.08) break;
}
vec3 direct = alb * vec3(3.4, 2.75, 1.9) * max(dot(n, lDir), 0.0) * spot * sh / (0.35 + 0.45 * dL * dL);
vec3 gi = sampleDDGIGrid(p, n, sunPatch, clamp(P_CHEBYSHEV, 0.0, 1.0)) * max(P_GI_BOUNCE, 0.0);
col = direct + alb * gi;
}
// Overlay visible 3D DDGI irradiance probe spheres on a 3x2x2 world lattice
float pRad = 0.085 * clamp(P_PROBE_SCALE, 0.0, 2.2);
if (pRad > 0.005) {
float bestT = hit ? t : 100.0;
for (int ix = 0; ix < 3; ix++) {
for (int iy = 0; iy < 2; iy++) {
for (int iz = 0; iz < 2; iz++) {
vec3 pc = vec3(-0.95 + float(ix) * 0.95, -0.35 + float(iy) * 0.82, -0.75 + float(iz) * 0.92);
vec3 oc = ro - pc;
float b = dot(oc, rd);
float c = dot(oc, oc) - pRad * pRad;
float disc = b * b - c;
if (disc > 0.0) {
float pt = -b - sqrt(disc);
if (pt > 0.05 && pt < bestT) {
bestT = pt;
vec3 pn = normalize(ro + rd * pt - pc);
vec3 probeCol = evalProbeIrradiance(pc, pn, sunPatch) * 1.45;
float rim = pow(1.0 - max(dot(pn, -rd), 0.0), 3.0);
col = probeCol + vec3(0.85, 0.92, 1.0) * rim * 0.35;
}
}
}
}
}
}
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).
DDGI starting layout
{
"probe_spacing_m": 2,
"grid_dims": [
22,
22,
22
],
"rays_per_probe": 192,
"irradiance_texels": 8,
"distance_texels": 16,
"hysteresis": 0.97,
"normal_bias_m": 0.1,
"view_bias_m": 0.1
}Attribution: written for this index; sensible starting values, tune per scene
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| ddgi-live | Tesla T4 1920x1080 | 54.0× baseline (heavy) · 1.78 ms / 1.87 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| ddgi-live | NVIDIA L4 1920x1080 | 51.7× baseline (heavy) · 0.823 ms / 0.835 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| ddgi-live | NVIDIA A100-SXM4-40GB 1920x1080 | 34.7× baseline (heavy) · 1.000 ms / 1.00 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- ReSTIR GI: Path Resampling for Real-Time Path Tracing: Probes supply stable low-frequency indirect while resampling handles high-frequency detail.
- Neural Radiance Caching: Probe lookups can terminate long paths in the same way a cache does.
Sources
- primaryZander Majercik, Jean-Philippe Guertin, Derek Nowrouzezahrai, Morgan McGuire. Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields. JCGT 2019.Verified via live page · 2026-11-29
- primaryZander Majercik et al.. Scaling Probe-Based Real-Time Dynamic Global Illumination for Production. JCGT 2021.Verified via live page · 2026-11-29
- implementationNVIDIA-RTX (2024). NVIDIA-RTX/RTXGI. RTXGI v2.0 Update including Neural Radiance Cache and Spatial Hash Radiance CacheGitHub API · license NOASSERTION · 2026-11-29