{
 "id": "irradiance-volumes",
 "title": "Irradiance Volumes and Light Probes",
 "aliases": [
  "light probes",
  "ambient cubes",
  "probe grids"
 ],
 "domain": "gi",
 "subdomain": "probe-based GI",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "unity",
  "unreal",
  "godot"
 ],
 "year_introduced": 1998,
 "inputs": [
  "irradiance-probes",
  "mesh"
 ],
 "outputs": [
  "irradiance-probes"
 ],
 "style": "photoreal",
 "dynamic": "both",
 "summary": "Stores precomputed irradiance at points in space (often as low-order spherical harmonics) and interpolates between them to light moving objects with indirect light consistent with the baked environment.",
 "how_it_works": "A light probe records how much light arrives at a point from each direction, compressed into a handful of coefficients, usually L1 or L2 [spherical-harmonics-lighting](spherical-harmonics-lighting) or a six-sided **ambient cube**. Probes are placed on a regular grid, on an adaptive tetrahedral mesh, or by hand near interesting lighting changes.\n\nBaking computes each probe's radiance from a skyline and scene capture (or an offline [path-tracing](path-tracing) of the neighbourhood) and projects it into the basis. At runtime an object finds the probes surrounding it, interpolates their coefficients (trilinearly in a grid, barycentrically in a tetrahedralization), and evaluates the irradiance for its normal in the shader. Because only a few numbers per probe are needed, thousands fit in a small buffer.\n\nCommon refinements: visibility-aware interpolation to prevent probes on the wrong side of a wall from contributing, **adaptive probe volumes** that subdivide where lighting varies, and runtime-updated probes ([ddgi](ddgi)) for dynamic GI.",
 "when_to_use": "Choose it for lighting dynamic characters and props in baked scenes, and for adding indirect light to volumes (fog, particles) where lightmaps cannot go.\n\nPrefer [lightmap-baking](lightmap-baking) for large static surfaces where per-texel detail is needed. Prefer [ddgi](ddgi) when the probes must update at runtime. Prefer [precomputed-radiance-transfer](precomputed-radiance-transfer) when objects need self-shadowing under changing low-frequency light. Prefer [spherical-harmonics-lighting](spherical-harmonics-lighting) alone when a single global environment is enough.",
 "cost": {
  "class": "cheap",
  "notes": "Per-pixel cost is interpolating a few coefficient sets; memory and bake time scale with probe count."
 },
 "failure_modes": [
  "Light leaking when interpolation mixes probes separated by a wall",
  "Low-order SH gives soft, low-contrast lighting that cannot represent sharp shadows or strong directional light, and can ring (negative lobes)",
  "Pop or discontinuity when an object switches tetrahedron or crosses a probe-volume boundary",
  "Probe placement inside geometry produces black or wrong probes unless invalid ones are detected and filled"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1109/38.656788",
   "type": "paper",
   "title": "The irradiance volume",
   "authors": [
    "G. Greger",
    "P. Shirley",
    "P.M. Hubbard",
    "D.P. Greenberg"
   ],
   "year": 1998,
   "venue": "IEEE Computer Graphics and Applications",
   "url": "https://doi.org/10.1109/38.656788",
   "ids": {
    "doi": "10.1109/38.656788"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.656788",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.656788",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.656788",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.656788",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.656788",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "greger1998irradiance"
  }
 ],
 "presets": [
  {
   "id": "irradiance-volumes-live",
   "title": "Irradiance Volumes & Light Probes — 3D trilinear SH probe lattice & directional probe spheres",
   "runtime": "glsl-fragment",
   "params": {
    "P_PROBE_SIZE": 0.11,
    "P_GI_STRENGTH": 1.25,
    "P_SUN_SWEEP": 1,
    "P_SH_CONTRAST": 1
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_PROBE_SIZE = 0.11; // P Probe Sphere Size [0.0, 0.18, 0.005]\nconst float P_GI_STRENGTH = 1.25; // P Volume GI Gain [0.2, 2.4, 0.05]\nconst float P_SUN_SWEEP = 1.0; // P Sun Motion [0.0, 2.5, 0.05]\nconst float P_SH_CONTRAST = 1.0; // P SH Directionality [0.2, 1.8, 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// Architectural gallery + 3x2x2 lattice of floating SH light-probe spheres\nvec2 mapScene(vec3 p, float probeR) {\n  vec2 res = vec2(1.0 + p.y, 1.0); // floor\n  float cD = 1.0 - p.y; if (cD < res.x) res = vec2(cD, 1.0);\n  float bD = 1.50 + p.z; if (bD < res.x) res = vec2(bD, 1.0);\n  float lD = 1.50 + p.x; if (lD < res.x) res = vec2(lD, 2.0); // warm amber-crimson wall\n  float rD = 1.50 - p.x; if (rD < res.x) res = vec2(rD, 3.0); // cool azure wall\n\n  // Central matte sculpture pedestal\n  float dPed = sdBox(p - vec3(0.0, -0.62, -0.35), vec3(0.42, 0.38, 0.34)) - 0.025;\n  if (dPed < res.x) res = vec2(dPed, 4.0);\n  float dStat = length(p - vec3(0.0, -0.02, -0.35)) - 0.26;\n  if (dStat < res.x) res = vec2(dStat, 4.0);\n\n  // Visible 3D irradiance probe lattice (3 in X, 2 in Y, 2 in Z)\n  if (probeR > 0.005) {\n    vec3 q = p - vec3(0.0, 0.05, -0.25);\n    vec3 id = clamp(floor(q / vec3(0.88, 0.78, 0.85) + 0.5), vec3(-1.0, 0.0, -1.0), vec3(1.0, 1.0, 0.0));\n    vec3 cellC = id * vec3(0.88, 0.78, 0.85) + vec3(0.0, 0.05, -0.25);\n    float dProbe = length(p - cellC) - probeR;\n    if (dProbe < res.x) res = vec2(dProbe, 5.0);\n  }\n  return res;\n}\n\nvec3 calcNormal(vec3 p, float probeR) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapScene(p + e.xyy, probeR).x - mapScene(p - e.xyy, probeR).x,\n    mapScene(p + e.yxy, probeR).x - mapScene(p - e.yxy, probeR).x,\n    mapScene(p + e.yyx, probeR).x - mapScene(p - e.yyx, probeR).x\n  ));\n}\n\n// Evaluate L0 + L1 Spherical Harmonics irradiance at a single 3D probe location probePos in direction dir\nvec3 evalSHProbe(vec3 probePos, vec3 dir, vec3 sunPos, float shContrast) {\n  // L0 isotropic ambient base\n  vec3 l0 = vec3(0.14, 0.16, 0.21);\n\n  // Directional SH lobes from warm crimson left wall, azure right wall, skylight ceiling, and moving sun bounce\n  float wLeft = exp(-max(probePos.x + 1.5, 0.0) * 0.75);\n  float wRight = exp(-max(1.5 - probePos.x, 0.0) * 0.75);\n  float wCeil = exp(-max(1.0 - probePos.y, 0.0) * 0.85);\n  vec3 toSun = sunPos - probePos;\n  float rSun = length(toSun) + 0.45;\n  vec3 dirSun = toSun / max(length(toSun), 1e-4);\n\n  // Cosine-convolved SH basis: 0.5 + 0.5 * dot(dir, sourceDir)\n  float cL = mix(0.5, max(dot(dir, vec3(-1.0, 0.0, 0.0)), 0.0), clamp(shContrast, 0.1, 1.5));\n  float cR = mix(0.5, max(dot(dir, vec3(1.0, 0.0, 0.0)), 0.0), clamp(shContrast, 0.1, 1.5));\n  float cU = mix(0.5, max(dot(dir, vec3(0.0, 1.0, 0.0)), 0.0), clamp(shContrast, 0.1, 1.5));\n  float cS = mix(0.5, max(dot(dir, dirSun), 0.0), clamp(shContrast, 0.1, 1.5));\n\n  vec3 irr = l0;\n  irr += vec3(1.18, 0.26, 0.14) * wLeft * cL * 1.15;\n  irr += vec3(0.14, 0.56, 1.18) * wRight * cR * 1.15;\n  irr += vec3(0.65, 0.78, 0.96) * wCeil * cU * 0.55;\n  irr += vec3(1.45, 1.12, 0.56) * cS / (rSun * rSun * 0.75 + 0.35);\n  return irr;\n}\n\n// Trilinear interpolation across the 3D irradiance probe volume grid\nvec3 sampleIrradianceVolume(vec3 p, vec3 n, vec3 sunPos, float shContrast) {\n  vec3 stepSz = vec3(0.88, 0.78, 0.85);\n  vec3 q = (p - vec3(0.0, 0.05, -0.25)) / stepSz;\n  vec3 b = floor(q);\n  vec3 f = fract(q);\n  vec3 o = vec3(0.0, 0.05, -0.25);\n\n  vec3 p000 = evalSHProbe((b + vec3(0.0, 0.0, 0.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p100 = evalSHProbe((b + vec3(1.0, 0.0, 0.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p010 = evalSHProbe((b + vec3(0.0, 1.0, 0.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p110 = evalSHProbe((b + vec3(1.0, 1.0, 0.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p001 = evalSHProbe((b + vec3(0.0, 0.0, 1.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p101 = evalSHProbe((b + vec3(1.0, 0.0, 1.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p011 = evalSHProbe((b + vec3(0.0, 1.0, 1.0)) * stepSz + o, n, sunPos, shContrast);\n  vec3 p111 = evalSHProbe((b + vec3(1.0, 1.0, 1.0)) * stepSz + o, n, sunPos, shContrast);\n\n  vec3 x00 = mix(p000, p100, f.x);\n  vec3 x10 = mix(p010, p110, f.x);\n  vec3 x01 = mix(p001, p101, f.x);\n  vec3 x11 = mix(p011, p111, f.x);\n  return mix(mix(x00, x10, f.y), mix(x01, x11, f.y), f.z);\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  float tAnim = iTime * max(P_SUN_SWEEP, 0.0);\n  float probeR = clamp(P_PROBE_SIZE, 0.0, 0.20);\n  float giGain = max(P_GI_STRENGTH, 0.0);\n  float shCon = clamp(P_SH_CONTRAST, 0.15, 1.8);\n\n  vec3 ro = vec3(0.28 * sin(tAnim * 0.35), 0.16, 2.35);\n  vec3 ta = vec3(0.0, -0.05, -0.45);\n  vec3 fw = normalize(ta - ro);\n  vec3 rt = normalize(cross(fw, vec3(0.0, 1.0, 0.0)));\n  vec3 up = cross(rt, fw);\n  vec3 rd = normalize(fw * 1.48 + rt * uv.x + up * uv.y);\n\n  vec3 sunPos = vec3(0.95 * cos(tAnim * 0.65), 0.72, -0.35 + 0.55 * sin(tAnim * 0.65));\n\n  vec3 col = vec3(0.02);\n  float t = 0.0;\n  float matId = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 68; i++) {\n    vec2 h = mapScene(ro + rd * t, probeR);\n    if (h.x < 0.002) { hit = true; matId = h.y; break; }\n    t += h.x;\n    if (t > 10.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, probeR);\n\n    if (matId > 4.5) {\n      // Light Probe visualization sphere: directly displays its stored directional SH irradiance E(n)!\n      vec3 shVis = evalSHProbe(p, n, sunPos, shCon) * giGain;\n      float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0);\n      col = shVis + vec3(0.85, 0.92, 1.0) * rim * 0.35;\n    } else {\n      vec3 alb = vec3(0.76, 0.76, 0.74);\n      if (matId > 1.5 && matId < 2.5) alb = vec3(0.88, 0.22, 0.14);\n      else if (matId > 2.5 && matId < 3.5) alb = vec3(0.14, 0.46, 0.88);\n      else if (matId > 3.5) alb = vec3(0.86, 0.85, 0.83);\n\n      // Direct light from moving overhead warm lamp\n      vec3 toL = sunPos - p;\n      float dL = length(toL);\n      vec3 lDir = toL / max(dL, 1e-4);\n      float diff = max(dot(n, lDir), 0.0);\n      vec3 direct = alb * vec3(1.9, 1.65, 1.25) * diff / (1.0 + 0.55 * dL * dL);\n\n      // Trilinearly interpolated 3D Irradiance Volume GI\n      vec3 irr = sampleIrradianceVolume(p, n, sunPos, shCon);\n      col = direct + alb * irr * giGain * 0.72;\n    }\n  }\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "reduced-sandbox",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "irradiance-volumes",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:04:31.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.7685,
      "std": 0.1092,
      "min": 0.1255,
      "max": 0.9566
     },
     "image": "/specimens/irradiance-volumes-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "lightmap-baking",
  "spherical-harmonics-lighting",
  "ddgi",
  "precomputed-radiance-transfer"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "lightmap-baking",
   "why": "Lightmaps cover static surfaces; the same bake feeds probes for moving objects."
  }
 ],
 "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/irradiance-volumes.json"
 },
 "solves": [
  "dynamic characters look unlit in baked scenes",
  "moving props don't pick up indirect light",
  "need bounce light on objects without lightmaps",
  "fog and particles need indirect lighting in baked levels"
 ],
 "authority": "Greger et al., 1998",
 "url": "https://texelatlas.vercel.app/t/irradiance-volumes/",
 "execution_fidelity": "reduced-sandbox",
 "fidelity_label": "Analytic Sandbox",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 25.92,
  "tier": "heavy",
  "p50_ms": 0.814,
  "p95_ms": 0.8577,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "irradiance-volumes-live",
  "execution_fidelity": "reduced-sandbox",
  "fidelity_label": "Analytic Sandbox",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 26.59,
   "tier": "heavy",
   "p50_ms": 0.4201,
   "p95_ms": 0.4268,
   "speedup_x": 1.94,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 17.17,
   "tier": "moderate",
   "p50_ms": 0.4945,
   "p95_ms": 0.502,
   "speedup_x": 1.65,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}