{
 "id": "instant-radiosity",
 "title": "Instant Radiosity (Virtual Point Lights)",
 "aliases": [
  "VPL",
  "many-lights GI"
 ],
 "domain": "gi",
 "subdomain": "many-light GI",
 "stage": "lighting",
 "realtime": "interactive",
 "platforms": [
  "desktop-gpu",
  "cpu"
 ],
 "year_introduced": 1997,
 "inputs": [
  "mesh",
  "gbuffer"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Approximates indirect light by tracing random particles from the light and placing a virtual point light at each hit, then lighting the scene with all those point lights using standard shadow-mapped direct lighting.",
 "how_it_works": "Indirect illumination is just direct illumination from surfaces that were lit. Instant radiosity makes this literal. A quasi-random walk is traced from each light source. Each time the particle hits a diffuse surface, the renderer drops a **virtual point light** there with a flux scaled by surface reflectance and the walk's survival probability, and the walk continues by Russian roulette.\n\nThe scene is then rendered as if lit by a few hundred to thousands of ordinary point lights, each with its own shadow map or ray cast. Because the VPLs form a Monte Carlo estimator of the path integral, the sum converges to indirect lighting. The same VPL set can be reused across frames (with changes only when lights move) and across the whole image, which is why this gave early interactive GI on GPUs.\n\nThe big flaw is that a point light has an unbounded `1/r^2` near-field, so surfaces close to a VPL show bright splotches. Clamping the contribution or using bounded-kernel virtual sphere lights trades this singularity for bias.",
 "when_to_use": "Choose it to prototype dynamic diffuse GI with ordinary shadow mapping, or as the conceptual basis for many-light rendering.\n\nPrefer [reflective-shadow-maps](reflective-shadow-maps) when only one-bounce indirect from a single light is needed and no shadow maps per VPL are affordable. Prefer [lightcuts](lightcuts) or [light-bvh-many-lights](light-bvh-many-lights) when thousands of VPLs must be gathered efficiently and cleanly. Prefer [path-tracing](path-tracing) for unbiased final images and [ddgi](ddgi) for today's real-time dynamic GI.",
 "cost": {
  "class": "heavy",
  "notes": "Shadow maps per VPL dominate; interactive on 1997-era hardware only for small VPL counts, and modern variants use imperfect shadow maps or ray tracing."
 },
 "failure_modes": [
  "Bright splotches and spikes near each VPL because of the singular 1/r^2 falloff",
  "Banding or a visible grid of overlapping VPL shadows when the VPL count is low",
  "Low-frequency-only: glossy transfer through VPLs is poor and very bright lamps cause noise",
  "Cost grows linearly with the VPL count times pixels unless gathered hierarchically"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/258734.258769",
   "type": "paper",
   "title": "Instant radiosity",
   "authors": [
    "Alexander Keller"
   ],
   "year": 1997,
   "venue": "Proceedings of the 24th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '97",
   "url": "https://doi.org/10.1145/258734.258769",
   "ids": {
    "doi": "10.1145/258734.258769"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258769",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258769",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258769",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258769",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258769",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "keller1997instant"
  }
 ],
 "presets": [
  {
   "id": "instant-radiosity-live",
   "title": "Instant Radiosity (VPLs) — bounce-spawned Virtual Point Lights & singularity clamp control",
   "runtime": "glsl-fragment",
   "params": {
    "P_VPL_GAIN": 1.3,
    "P_CLAMP_EPS": 0.28,
    "P_SHOW_VPLS": 1,
    "P_BEAM_SPEED": 1
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_VPL_GAIN = 1.3; // P VPL Bounce Gain [0.0, 2.6, 0.05]\nconst float P_CLAMP_EPS = 0.28; // P Clamp Radius [0.04, 0.75, 0.02]\nconst float P_SHOW_VPLS = 1.0; // P Show VPL Nodes [0.0, 1.5, 0.05]\nconst float P_BEAM_SPEED = 1.0; // P Light Orbit [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\nvec2 mapRoom(vec3 p) {\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.45 + p.z; if (bD < res.x) res = vec2(bD, 1.0);\n  float lD = 1.45 + p.x; if (lD < res.x) res = vec2(lD, 2.0); // ruby red wall\n  float rD = 1.45 - p.x; if (rD < res.x) res = vec2(rD, 3.0); // emerald green wall\n\n  float dB1 = sdBox(p - vec3(-0.48, -0.45, -0.45), vec3(0.28, 0.55, 0.28)) - 0.02;\n  if (dB1 < res.x) res = vec2(dB1, 4.0);\n  float dB2 = sdBox(p - vec3(0.55, -0.68, -0.15), vec3(0.30, 0.32, 0.30)) - 0.02;\n  if (dB2 < res.x) res = vec2(dB2, 4.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapRoom(p + e.xyy).x - mapRoom(p - e.xyy).x,\n    mapRoom(p + e.yxy).x - mapRoom(p - e.yxy).x,\n    mapRoom(p + e.yyx).x - mapRoom(p - e.yyx).x\n  ));\n}\n\nvec3 getAlbedo(float id) {\n  if (id < 1.5) return vec3(0.75, 0.75, 0.74);\n  if (id < 2.5) return vec3(0.90, 0.16, 0.14);\n  if (id < 3.5) return vec3(0.14, 0.80, 0.42);\n  return vec3(0.84, 0.84, 0.82);\n}\n\n// Compute 6 deterministic first-bounce Virtual Point Lights spawned from the primary light source\nvoid getVPL(int k, vec3 lPos, out vec3 vPos, out vec3 vNorm, out vec3 vFlux) {\n  if (k == 0) {\n    vPos = vec3(-1.44, -0.10, -0.25); vNorm = vec3(1.0, 0.0, 0.0); vFlux = vec3(1.0, 0.18, 0.15);\n  } else if (k == 1) {\n    vPos = vec3(-1.44, 0.35, -0.82); vNorm = vec3(1.0, 0.0, 0.0); vFlux = vec3(0.95, 0.16, 0.14);\n  } else if (k == 2) {\n    vPos = vec3(1.44, -0.15, -0.35); vNorm = vec3(-1.0, 0.0, 0.0); vFlux = vec3(0.16, 0.92, 0.48);\n  } else if (k == 3) {\n    vPos = vec3(1.44, 0.32, -0.92); vNorm = vec3(-1.0, 0.0, 0.0); vFlux = vec3(0.14, 0.86, 0.44);\n  } else if (k == 4) {\n    vPos = vec3(0.05, -0.99, -0.45); vNorm = vec3(0.0, 1.0, 0.0); vFlux = vec3(0.88, 0.85, 0.78);\n  } else {\n    vPos = vec3(0.0, -0.05, -1.44); vNorm = vec3(0.0, 0.0, 1.0); vFlux = vec3(0.86, 0.84, 0.80);\n  }\n  // Modulate each VPL flux by incident direct illumination from moving primary ceiling lamp\n  vec3 toL = lPos - vPos;\n  float d = length(toL);\n  float inc = max(dot(vNorm, toL / max(d, 1e-4)), 0.0) / (0.45 + 0.35 * d * d);\n  vFlux *= inc * 2.2;\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_BEAM_SPEED, 0.0);\n  float vplGain = max(P_VPL_GAIN, 0.0);\n  float clampEps = max(P_CLAMP_EPS, 0.03);\n  float showVpls = clamp(P_SHOW_VPLS, 0.0, 1.6);\n\n  vec3 ro = vec3(0.0, 0.04, 2.38);\n  vec3 rd = normalize(vec3(uv, -1.48));\n  vec3 lightPos = vec3(0.68 * sin(tAnim * 0.65), 0.78, -0.35 + 0.45 * cos(tAnim * 0.52));\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 < 64; i++) {\n    vec2 h = mapRoom(ro + rd * t);\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);\n    vec3 alb = getAlbedo(matId);\n\n    // Direct primary light with shadow ray\n    vec3 toL = lightPos - p;\n    float dL = length(toL);\n    vec3 lDir = toL / max(dL, 1e-4);\n    float sh = 1.0;\n    float ts = 0.03;\n    for (int i = 0; i < 22; i++) {\n      float dh = mapRoom(p + lDir * ts).x;\n      if (dh < 0.004) { sh = 0.0; break; }\n      ts += dh;\n      if (ts > dL - 0.08) break;\n    }\n    vec3 direct = alb * vec3(1.9, 1.75, 1.45) * max(dot(n, lDir), 0.0) * sh / (0.5 + 0.45 * dL * dL);\n\n    // Instant Radiosity VPL Gather with adjustable weak-singularity clamp (1 / max(r^2, eps^2))\n    vec3 vplBounce = vec3(0.0);\n    vec3 vplMarker = vec3(0.0);\n    for (int k = 0; k < 6; k++) {\n      vec3 vp, vn, vf;\n      getVPL(k, lightPos, vp, vn, vf);\n      vec3 toV = vp - p;\n      float r2 = dot(toV, toV);\n      float r = sqrt(max(r2, 1e-5));\n      vec3 dv = toV / r;\n      float cosP = max(dot(n, dv), 0.0);\n      float cosV = max(dot(vn, -dv), 0.0);\n      // Geometry factor clamped by P_CLAMP_EPS^2 to control bright VPL corner singularities!\n      float gTerm = (cosP * cosV) / max(r2, clampEps * clampEps);\n      vplBounce += vf * gTerm * 0.24;\n\n      // Render glowing VPL emitter beacon at bounce site\n      if (showVpls > 0.01) {\n        float dMark = length(p - vp);\n        vplMarker += (vf * 1.4 + vec3(0.35)) * smoothstep(0.095, 0.028, dMark) * showVpls;\n      }\n    }\n\n    col = direct + alb * vplBounce * vplGain + vplMarker;\n  }\n\n  // Primary orbiting light bulb flare in space\n  vec3 toBulb = lightPos - ro;\n  float proj = dot(toBulb, rd);\n  if (proj > 0.0 && proj < t) {\n    float db = length(ro + rd * proj - lightPos);\n    col += vec3(2.8, 2.4, 1.7) * exp(-db * 22.0);\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": "instant-radiosity",
     "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.6086,
      "std": 0.3701,
      "min": 0,
      "max": 0.9801
     },
     "image": "/specimens/instant-radiosity-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "reflective-shadow-maps",
  "lightcuts",
  "radiosity",
  "photon-mapping"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "lightcuts",
   "why": "A light cut clusters the VPL set so each pixel evaluates only a small subset."
  }
 ],
 "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/instant-radiosity.json"
 },
 "solves": [
  "want dynamic diffuse bounce light using ordinary shadow maps",
  "prototype global illumination quickly",
  "indirect lighting without precomputed bake",
  "approximate light bounces with many small lights",
  "colour bleeding in a real-time scene"
 ],
 "authority": "Keller, 1997",
 "url": "https://texelatlas.vercel.app/t/instant-radiosity/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 30.53,
  "tier": "heavy",
  "p50_ms": 0.9587,
  "p95_ms": 1.0267,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "instant-radiosity-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 30.37,
   "tier": "heavy",
   "p50_ms": 0.4799,
   "p95_ms": 0.4885,
   "speedup_x": 2,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 18.57,
   "tier": "moderate",
   "p50_ms": 0.5348,
   "p95_ms": 0.5428,
   "speedup_x": 1.79,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}