{
 "id": "ddgi",
 "title": "Dynamic Diffuse Global Illumination (DDGI)",
 "aliases": [
  "RTXGI probes",
  "irradiance fields"
 ],
 "domain": "gi",
 "subdomain": "probe-based GI",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "unreal",
  "unity"
 ],
 "year_introduced": 2019,
 "inputs": [
  "mesh",
  "irradiance-probes"
 ],
 "outputs": [
  "irradiance-probes",
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "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.",
 "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.\n\nEach 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.\n\nAt 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_use": "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.\n\nPrefer [lumen-gi](lumen-gi) or [surfel-gi](surfel-gi) when you need finer spatial detail or large scenes without placing grids by hand. Prefer [radiance-cascades](radiance-cascades) when you need sharper shadows from indirect light in screen-space or 2D. Prefer [irradiance-volumes](irradiance-volumes) or [lightmap-baking](lightmap-baking) when everything is static or you target hardware without ray tracing. Prefer [restir-gi](restir-gi) for high-frequency per-pixel indirect.",
 "cost": {
  "class": "medium",
  "notes": "Ray count scales with probes times rays per probe, plus a probe-sampling pass in shading; the JCGT follow-up reports production-scale tuning."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://jcgt.org/published/0008/02/01",
   "type": "web",
   "title": "Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields",
   "authors": [
    "Zander Majercik",
    "Jean-Philippe Guertin",
    "Derek Nowrouzezahrai",
    "Morgan McGuire"
   ],
   "year": null,
   "venue": "JCGT 2019",
   "url": "https://jcgt.org/published/0008/02/01",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261117112853/https://jcgt.org/published/0008/02/01/",
     "timestamp": "20261117112853"
    },
    "page_title": null,
    "host": "jcgt.org",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://jcgt.org/published/0008/02/01 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "majercikdynamic"
  },
  {
   "role": "primary",
   "key": "url:https://jcgt.org/published/0010/02/01",
   "type": "web",
   "title": "Scaling Probe-Based Real-Time Dynamic Global Illumination for Production",
   "authors": [
    "Zander Majercik et al."
   ],
   "year": null,
   "venue": "JCGT 2021",
   "url": "https://jcgt.org/published/0010/02/01",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261128090318/https://jcgt.org/published/0010/02/01/",
     "timestamp": "20261128090318"
    },
    "page_title": null,
    "host": "jcgt.org",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://jcgt.org/published/0010/02/01 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "alscaling"
  },
  {
   "role": "implementation",
   "key": "gh:nvidia-rtx/rtxgi",
   "type": "code",
   "title": "NVIDIA-RTX/RTXGI",
   "description": "RTXGI v2.0 Update including Neural Radiance Cache and Spatial Hash Radiance Cache ",
   "authors": [
    "NVIDIA-RTX"
   ],
   "year": 2024,
   "venue": "GitHub",
   "url": "https://github.com/NVIDIA-RTX/RTXGI",
   "ids": {
    "repo": "NVIDIA-RTX/RTXGI"
   },
   "license": "NOASSERTION",
   "extra": {
    "stars": 380,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-12T10:08:02Z",
    "language": "C++",
    "homepage": null,
    "license_name": "Other"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/RTXGI",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "nvidiartx2024nvidiab"
  }
 ],
 "presets": [
  {
   "id": "ddgi-live",
   "title": "Dynamic Diffuse GI (DDGI) — trilinear irradiance probe lattice & Chebyshev visibility",
   "runtime": "glsl-fragment",
   "params": {
    "P_PROBE_SCALE": 1,
    "P_GI_BOUNCE": 1.35,
    "P_CHEBYSHEV": 0.88,
    "P_SUN_SWEEP": 1
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_PROBE_SCALE = 1.0; // P Probe Spheres [0.0, 2.0, 0.05]\nconst float P_GI_BOUNCE = 1.35; // P Probe GI Gain [0.0, 2.5, 0.05]\nconst float P_CHEBYSHEV = 0.88; // P Leak Guard [0.0, 1.0, 0.02]\nconst float P_SUN_SWEEP = 1.0; // P Sun Sweep [0.0, 2.5, 0.05]\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\n// Room with central divider wall + vibrant colored bounce walls to demonstrate DDGI Chebyshev leak prevention\nvec2 mapScene(vec3 p) {\n  vec2 res = vec2(1.05 + p.y, 1.0); // floor\n  float ceilD = 1.05 - p.y; if (ceilD < res.x) res = vec2(ceilD, 1.0);\n  float backD = 1.55 + p.z; if (backD < res.x) res = vec2(backD, 1.0);\n  float leftD = 1.55 + p.x; if (leftD < res.x) res = vec2(leftD, 2.0); // warm crimson wall\n  float rightD = 1.55 - p.x; if (rightD < res.x) res = vec2(rightD, 3.0); // azure blue wall\n\n  // Central thin divider baffle wall (classic DDGI light-leak test geometry)\n  float dWall = sdBox(p - vec3(-0.08, -0.35, -0.25), vec3(0.08, 0.72, 0.58));\n  if (dWall < res.x) res = vec2(dWall, 4.0);\n\n  // Foreground matte display block on right side\n  float dBlk = sdBox(p - vec3(0.72, -0.68, -0.15), vec3(0.32, 0.37, 0.32)) - 0.02;\n  if (dBlk < res.x) res = vec2(dBlk, 4.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapScene(p + e.xyy).x - mapScene(p - e.xyy).x,\n    mapScene(p + e.yxy).x - mapScene(p - e.yxy).x,\n    mapScene(p + e.yyx).x - mapScene(p - e.yyx).x\n  ));\n}\n\n// Evaluate directional octahedral irradiance stored in a DDGI probe at world position probePos\nvec3 evalProbeIrradiance(vec3 probePos, vec3 dir, vec3 sunPatch) {\n  // Analytical bounce contributions from red left wall, blue right wall, and moving sunlit floor patch\n  vec3 toLeft = normalize(vec3(-1.55, probePos.y, probePos.z) - probePos);\n  vec3 toRight = normalize(vec3(1.55, probePos.y, probePos.z) - probePos);\n  vec3 toPatch = sunPatch - probePos;\n  float patchDist = length(toPatch) + 1e-4;\n  vec3 patchDir = toPatch / patchDist;\n\n  float wLeft = pow(max(dot(dir, toLeft) * 0.5 + 0.5, 0.0), 1.8) / (0.65 + pow(probePos.x + 1.55, 2.0));\n  float wRight = pow(max(dot(dir, toRight) * 0.5 + 0.5, 0.0), 1.8) / (0.65 + pow(1.55 - probePos.x, 2.0));\n  float wPatch = pow(max(dot(dir, patchDir) * 0.5 + 0.5, 0.0), 2.2) / (0.35 + patchDist * patchDist);\n\n  // Baffle wall blocks cross-room probe bounce between left (x < -0.08) and right (x > -0.08)\n  float sameSidePatch = smoothstep(-0.2, 0.2, (probePos.x + 0.08) * (sunPatch.x + 0.08));\n  vec3 irr = vec3(0.05, 0.06, 0.08);\n  irr += vec3(1.35, 0.22, 0.14) * wLeft * (0.45 + 0.55 * step(probePos.x, 0.1));\n  irr += vec3(0.16, 0.48, 1.35) * wRight * (0.45 + 0.55 * step(-0.2, probePos.x));\n  irr += vec3(2.4, 1.85, 1.15) * wPatch * mix(0.25, 1.0, sameSidePatch);\n  return irr;\n}\n\n// Trilinear DDGI probe grid lookup with smooth-backface & Chebyshev distance-visibility weighting\nvec3 sampleDDGIGrid(vec3 p, vec3 n, vec3 sunPatch, float chebStrength) {\n  vec3 spacing = vec3(0.95, 0.78, 0.95);\n  vec3 origin = vec3(-0.95, -0.58, -0.95);\n  vec3 gridCoord = (p - origin) / spacing;\n  vec3 baseCell = clamp(floor(gridCoord), vec3(0.0), vec3(1.0));\n  vec3 alpha = clamp(gridCoord - baseCell, 0.0, 1.0);\n\n  vec3 sumIrr = vec3(0.0);\n  float sumW = 0.0;\n\n  for (int i = 0; i < 8; i++) {\n    vec3 off = vec3(\n      mod(float(i), 2.0),\n      mod(floor(float(i) * 0.5), 2.0),\n      floor(float(i) * 0.25)\n    );\n    vec3 probePos = origin + (baseCell + off) * spacing;\n    vec3 trilin = mix(1.0 - alpha, alpha, off);\n    float w = trilin.x * trilin.y * trilin.z;\n\n    vec3 toProbe = probePos - p;\n    float dProbe = length(toProbe) + 1e-4;\n    vec3 dirToProbe = toProbe / dProbe;\n\n    // Smooth backface weight: ((dot(N, dirToProbe) + 1) / 2)^2\n    float wrap = 0.5 * dot(n, dirToProbe) + 0.5;\n    w *= wrap * wrap + 0.04;\n\n    // Chebyshev visibility test across baffle wall: attenuate probes on opposite side of divider\n    float midD = mapScene(0.5 * (p + probePos)).x;\n    float vis = smoothstep(-0.02, 0.12, midD);\n    w *= mix(1.0, max(vis, 0.02), chebStrength);\n\n    sumIrr += evalProbeIrradiance(probePos, n, sunPatch) * w;\n    sumW += w;\n  }\n  return sumIrr / max(sumW, 1e-4);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n\n  vec3 ro = vec3(0.0, 0.14, 2.55);\n  vec3 rd = normalize(vec3(uv, -1.38));\n\n  float sweep = iTime * 0.65 * max(P_SUN_SWEEP, 0.0);\n  vec3 sunPatch = vec3(0.85 * sin(sweep), -0.95, -0.35 + 0.35 * cos(sweep * 0.8));\n  vec3 sunOrigin = vec3(sunPatch.x * 0.65, 0.98, 0.25);\n\n  // Raymarch room geometry\n  float t = 0.0;\n  float matId = 1.0;\n  bool hit = false;\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapScene(ro + rd * t);\n    if (h.x < 0.002) { matId = h.y; hit = true; break; }\n    t += h.x;\n    if (t > 9.0) break;\n  }\n\n  vec3 col = vec3(0.02);\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p);\n\n    vec3 alb = vec3(0.78, 0.77, 0.75);\n    if (matId > 1.5 && matId < 2.5) alb = vec3(0.86, 0.18, 0.14);\n    else if (matId > 2.5 && matId < 3.5) alb = vec3(0.14, 0.44, 0.88);\n\n    // Direct spotlight sweeping across the room\n    vec3 toL = sunOrigin - p;\n    float dL = length(toL) + 1e-4;\n    vec3 lDir = toL / dL;\n    vec3 spotDir = normalize(sunPatch - sunOrigin);\n    float spot = smoothstep(0.62, 0.88, dot(-lDir, spotDir));\n\n    float sh = 1.0;\n    float ts = 0.04;\n    for (int s = 0; s < 18; s++) {\n      float dh = mapScene(p + n * 0.015 + lDir * ts).x;\n      sh = min(sh, clamp(6.0 * dh / ts, 0.0, 1.0));\n      ts += max(dh, 0.05);\n      if (ts > dL - 0.08) break;\n    }\n\n    vec3 direct = alb * vec3(3.4, 2.75, 1.9) * max(dot(n, lDir), 0.0) * spot * sh / (0.35 + 0.45 * dL * dL);\n    vec3 gi = sampleDDGIGrid(p, n, sunPatch, clamp(P_CHEBYSHEV, 0.0, 1.0)) * max(P_GI_BOUNCE, 0.0);\n    col = direct + alb * gi;\n  }\n\n  // Overlay visible 3D DDGI irradiance probe spheres on a 3x2x2 world lattice\n  float pRad = 0.085 * clamp(P_PROBE_SCALE, 0.0, 2.2);\n  if (pRad > 0.005) {\n    float bestT = hit ? t : 100.0;\n    for (int ix = 0; ix < 3; ix++) {\n      for (int iy = 0; iy < 2; iy++) {\n        for (int iz = 0; iz < 2; iz++) {\n          vec3 pc = vec3(-0.95 + float(ix) * 0.95, -0.35 + float(iy) * 0.82, -0.75 + float(iz) * 0.92);\n          vec3 oc = ro - pc;\n          float b = dot(oc, rd);\n          float c = dot(oc, oc) - pRad * pRad;\n          float disc = b * b - c;\n          if (disc > 0.0) {\n            float pt = -b - sqrt(disc);\n            if (pt > 0.05 && pt < bestT) {\n              bestT = pt;\n              vec3 pn = normalize(ro + rd * pt - pc);\n              vec3 probeCol = evalProbeIrradiance(pc, pn, sunPatch) * 1.45;\n              float rim = pow(1.0 - max(dot(pn, -rd), 0.0), 3.0);\n              col = probeCol + vec3(0.85, 0.92, 1.0) * rim * 0.35;\n            }\n          }\n        }\n      }\n    }\n  }\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "ddgi",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:50:13.852Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.7243,
      "std": 0.1262,
      "unique_colors": 225
     },
     "image": "/specimens/ddgi-live.webp",
     "reason": null
    }
   }
  },
  {
   "id": "ddgi-default-layout",
   "title": "DDGI starting layout",
   "runtime": "json-params",
   "params": {
    "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
   },
   "code": "",
   "basis": "original",
   "license_note": "written for this index; sensible starting values, tune per scene",
   "execution_fidelity": "parameter-only",
   "proof": {
    "kind": "parameter",
    "label": "parameter preset",
    "ok": true,
    "proof": null
   }
  }
 ],
 "related": [
  "irradiance-volumes",
  "radiance-cascades",
  "lumen-gi",
  "surfel-gi",
  "light-propagation-volumes"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "restir-gi",
   "why": "Probes supply stable low-frequency indirect while resampling handles high-frequency detail."
  },
  {
   "id": "neural-radiance-caching",
   "why": "Probe lookups can terminate long paths in the same way a cache does."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/gi/ddgi.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Majercik et al.",
 "url": "https://texelatlas.vercel.app/t/ddgi/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 53.97,
  "tier": "heavy",
  "p50_ms": 1.7757,
  "p95_ms": 1.8663,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "ddgi-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 51.73,
   "tier": "heavy",
   "p50_ms": 0.8225,
   "p95_ms": 0.8346,
   "speedup_x": 2.16,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 34.72,
   "tier": "heavy",
   "p50_ms": 0.9999,
   "p95_ms": 1.003,
   "speedup_x": 1.78,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}