{
 "id": "lumen-gi",
 "title": "SDF-Based Software Ray Tracing GI (Lumen-style)",
 "aliases": [
  "Lumen",
  "SDF GI",
  "Surface cache GI"
 ],
 "domain": "gi",
 "subdomain": "hybrid tracing GI",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "unreal",
  "desktop-gpu"
 ],
 "year_introduced": 2021,
 "inputs": [
  "mesh",
  "sdf",
  "gbuffer",
  "depth"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Traces rays through per-mesh and global signed distance fields, and shades hits from a cached, low-resolution lit representation of surfaces, with screen-space probes gathering the result. Fully dynamic GI without hardware RT.",
 "how_it_works": "The system splits the problem into *what do I hit* and *what light is there*. Hit finding uses **signed distance fields**: each mesh has a precomputed SDF, and a coarse global SDF (a camera-centred clipmap) is built on the fly. Rays sphere-trace the global SDF for far hits and the per-mesh SDFs near the camera; hardware ray tracing can replace them where available.\n\nShading hits is expensive, so Lumen keeps a **surface cache**: each mesh has a set of low-resolution cards (axis-aligned captures with albedo, normals and emissive) that are lit with direct lighting and prior-frame indirect light on a time-sliced schedule. A ray that hits a surface just looks up the cached radiance at the corresponding card texel.\n\nFinal gather uses **screen-space probes** placed on a coarse tile grid in the G-buffer. Each probe traces a few dozen rays with importance sampling toward the BRDF and previous radiance, the results are projected to spherical harmonics or octahedral maps, then interpolated to pixels with filtering and temporal accumulation. A world-space radiance cache covers far-field and reflections.",
 "when_to_use": "Choose the approach (not necessarily the engine) when you need fully dynamic, large-scale GI and reflections across scalable hardware, and your content is mesh-based so SDFs can be generated.\n\nPrefer [ddgi](ddgi) when you control scene scale, want simpler code and have hardware ray tracing. Prefer [surfel-gi](surfel-gi) when you want a surface-cache design based on surfels with hardware RT. Prefer [voxel-cone-tracing](voxel-cone-tracing) for simpler engines without per-mesh SDFs. Prefer [restir-gi](restir-gi) when you want pixel-accurate indirect with a high-end GPU budget.",
 "cost": {
  "class": "heavy",
  "notes": "Designed for a few milliseconds on current-generation consoles at reduced internal resolution; cost grows with screen probe count and SDF complexity."
 },
 "failure_modes": [
  "Thin walls and small details missing from coarse SDFs cause light leaks and missing occlusion",
  "Surface cache cards give inaccurate lighting on complex or concave meshes and when UVs/cards cover surfaces poorly",
  "Slow temporal accumulation shows lag when lights or doors move quickly",
  "Small-scale indirect detail and glossy reflections are noisy or blurry because the screen probes are sparse"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://advances.realtimerendering.com/s2022/index.html",
   "type": "web",
   "title": "Lumen: Real-time Global Illumination in Unreal Engine 5",
   "authors": [
    "Daniel Wright et al."
   ],
   "year": null,
   "venue": "SIGGRAPH 2022 Advances in Real-Time Rendering",
   "url": "https://advances.realtimerendering.com/s2022/index.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": null,
    "page_title": null,
    "host": "advances.realtimerendering.com",
    "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://advances.realtimerendering.com/s2022/index.html → 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": "allumen"
  }
 ],
 "presets": [
  {
   "id": "lumen-gi-live",
   "title": "SDF-Based Software Ray Tracing GI (Lumen-style) — real-time SDF hemisphere tracing & surface cache cards",
   "runtime": "glsl-fragment",
   "params": {
    "P_GI_INTENSITY": 1.4,
    "P_TRACE_DIST": 2.2,
    "P_SUN_ANGLE": 0.6,
    "P_SPLIT": 0.4
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_GI_INTENSITY = 1.4; // P SDF GI Bounce [0.0, 2.8, 0.05]\nconst float P_TRACE_DIST = 2.2; // P SDF Trace Range [0.6, 3.6, 0.1]\nconst float P_SUN_ANGLE = 0.6; // P Sun Elevation [0.15, 1.25, 0.03]\nconst float P_SPLIT = 0.40; // P Direct / Lumen GI [0.0, 1.0, 0.02]\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// Sunlit architectural atrium SDF (open roof skylight + terracotta bounce wall + columns)\nvec2 mapAtrium(vec3 p) {\n  vec2 res = vec2(1.0 + p.y, 1.0); // limestone floor\n  // Roof slab with central sunlit skylight opening\n  float roof = max(1.0 - p.y, -(sdBox(p - vec3(0.0, 1.0, -0.35), vec3(0.62, 0.4, 0.58))));\n  if (roof < res.x) res = vec2(roof, 1.0);\n  float backW = 1.55 + p.z; if (backW < res.x) res = vec2(backW, 1.0);\n  float leftW = 1.50 + p.x; if (leftW < res.x) res = vec2(leftW, 2.0); // sunlit terracotta bounce card\n  float rightW = 1.50 - p.x; if (rightW < res.x) res = vec2(rightW, 3.0); // sage-emerald bounce card\n\n  // Twin colonnade piers & sculpted pedestal orb\n  float dP1 = sdBox(p - vec3(-0.68, 0.0, -0.78), vec3(0.18, 1.0, 0.18)) - 0.02;\n  if (dP1 < res.x) res = vec2(dP1, 4.0);\n  float dP2 = sdBox(p - vec3(0.68, 0.0, -0.78), vec3(0.18, 1.0, 0.18)) - 0.02;\n  if (dP2 < res.x) res = vec2(dP2, 4.0);\n  float dSph = length(p - vec3(0.0, -0.58, -0.30)) - 0.40;\n  if (dSph < res.x) res = vec2(dSph, 4.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapAtrium(p + e.xyy).x - mapAtrium(p - e.xyy).x,\n    mapAtrium(p + e.yxy).x - mapAtrium(p - e.yxy).x,\n    mapAtrium(p + e.yyx).x - mapAtrium(p - e.yyx).x\n  ));\n}\n\nvec3 surfaceAlbedo(float id) {\n  if (id < 1.5) return vec3(0.76, 0.74, 0.70);\n  if (id < 2.5) return vec3(0.92, 0.34, 0.14); // terracotta\n  if (id < 3.5) return vec3(0.14, 0.68, 0.56); // turquoise-sage\n  return vec3(0.86, 0.85, 0.82);\n}\n\n// Fast SDF sun visibility shadow test\nfloat sunVis(vec3 p, vec3 sunDir) {\n  float t = 0.04;\n  for (int i = 0; i < 20; i++) {\n    float d = mapAtrium(p + sunDir * t).x;\n    if (d < 0.004) return 0.0;\n    t += max(d, 0.02);\n    if (t > 4.2) return 1.0;\n  }\n  return 1.0;\n}\n\n// Evaluate Lumen-style Surface Cache radiance at an SDF secondary ray hit\nvec3 sampleSurfaceCache(vec3 hitP, float hitId, vec3 sunDir) {\n  vec3 n = calcNormal(hitP);\n  vec3 alb = surfaceAlbedo(hitId);\n  float vis = sunVis(hitP + n * 0.02, sunDir);\n  float ndl = max(dot(n, sunDir), 0.0);\n  return alb * (vec3(3.1, 2.65, 2.0) * ndl * vis + vec3(0.18, 0.24, 0.34));\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 screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  float giGain = max(P_GI_INTENSITY, 0.0);\n  float maxTrace = clamp(P_TRACE_DIST, 0.5, 4.0);\n  float sunElev = clamp(P_SUN_ANGLE, 0.15, 1.35);\n\n  vec3 ro = vec3(0.0, 0.05, 2.32);\n  vec3 rd = normalize(vec3(uv, -1.48));\n  float sunAz = sin(iTime * 0.45) * 0.85;\n  vec3 sunDir = normalize(vec3(sin(sunAz), sunElev + 0.45, cos(sunAz) * 0.35));\n\n  vec3 skyCol = vec3(0.45, 0.72, 1.15) * 1.4;\n  vec3 col = skyCol;\n\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 = mapAtrium(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 = surfaceAlbedo(matId);\n\n    // Direct sun illumination through skylight\n    float vis = sunVis(p + n * 0.02, sunDir);\n    vec3 direct = alb * vec3(2.8, 2.45, 1.95) * max(dot(n, sunDir), 0.0) * vis;\n\n    // Lumen-style Software SDF Hemisphere Ray Tracing (6 deterministic Fibonacci hemisphere rays)\n    vec3 upVec = (abs(n.y) < 0.9) ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n    vec3 tang = normalize(cross(upVec, n));\n    vec3 bitang = cross(n, tang);\n    float jitter = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n\n    vec3 giAccum = vec3(0.0);\n    for (int r = 0; r < 6; r++) {\n      float fr = float(r);\n      float phi = (fr + jitter * 0.5) * 2.399963 + 0.4;\n      float cosTheta = clamp((fr + 0.5) / 6.0, 0.15, 0.96);\n      float sinTheta = sqrt(max(1.0 - cosTheta * cosTheta, 0.0));\n      vec3 rDir = normalize(tang * (cos(phi) * sinTheta) + bitang * (sin(phi) * sinTheta) + n * cosTheta);\n\n      // Sphere-trace global distance field\n      float tr = 0.05;\n      bool rHit = false;\n      float rMat = 0.0;\n      for (int s = 0; s < 14; s++) {\n        vec2 rh = mapAtrium(p + n * 0.03 + rDir * tr);\n        if (rh.x < 0.015) { rHit = true; rMat = rh.y; break; }\n        tr += max(rh.x, 0.04);\n        if (tr > maxTrace) break;\n      }\n      if (rHit) {\n        giAccum += sampleSurfaceCache(p + n * 0.03 + rDir * tr, rMat, sunDir);\n      } else {\n        // Ray escaped through skylight -> sample procedural sky radiance\n        giAccum += skyCol * smoothstep(-0.1, 0.65, rDir.y) * 0.85;\n      }\n    }\n    vec3 indirect = alb * (giAccum / 6.0) * giGain;\n\n    vec3 directOnly = direct + alb * vec3(0.03, 0.04, 0.055);\n    col = (screenX < split) ? directOnly : (direct + indirect);\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\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": "lumen-gi",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:04:33.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4172,
      "std": 0.2129,
      "min": 0.1614,
      "max": 0.9532
     },
     "image": "/specimens/lumen-gi-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "ddgi",
  "surfel-gi",
  "voxel-cone-tracing",
  "screen-space-gi"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "screen-space-gi",
   "why": "Screen-space traces supply exact near-field hits before falling back to the SDF."
  }
 ],
 "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/lumen-gi.json"
 },
 "solves": [
  "need fully dynamic global illumination without baking",
  "no hardware ray tracing but want dynamic bounce light",
  "large scenes need scalable indirect lighting and reflections",
  "lighting must update when geometry or sun moves"
 ],
 "authority": "Wright et al.",
 "url": "https://texelatlas.vercel.app/t/lumen-gi/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 201.23,
  "tier": "extreme",
  "p50_ms": 6.3186,
  "p95_ms": 6.4033,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "lumen-gi-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 220.39,
   "tier": "extreme",
   "p50_ms": 3.4821,
   "p95_ms": 3.583,
   "speedup_x": 1.81,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 134.19,
   "tier": "extreme",
   "p50_ms": 3.8646,
   "p95_ms": 3.8728,
   "speedup_x": 1.63,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}