{
 "id": "neural-radiance-caching",
 "title": "Neural Radiance Caching",
 "aliases": [
  "NRC"
 ],
 "domain": "gi",
 "subdomain": "learned radiance caches",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "cuda"
 ],
 "year_introduced": 2021,
 "inputs": [
  "gbuffer",
  "mesh",
  "material-params"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Trains a small neural network online, every frame, to predict outgoing radiance at any surface point. Short path-traced paths end at a cache query, giving multi-bounce GI with one or two samples per pixel.",
 "how_it_works": "The cache is a compact MLP (with a multiresolution hash-encoded input) that maps position, normal, view direction and material parameters to outgoing radiance. It is trained **while rendering**, with no precomputed data.\n\nEach frame has two kinds of paths. **Render paths** start at the camera, and after one or two bounces query the cache and stop, so the image is cheap. A tiny fraction of paths are extended into longer **training paths**: they are traced several bounces and the radiance estimate at each vertex becomes a training target for the network, computed by accumulating the actual downstream path contributions and, for the tail, the cache's own prediction (a self-bootstrapping scheme like value iteration in reinforcement learning).\n\nThe network takes a handful of gradient steps per frame on these samples, so it tracks changes in light and geometry within a few frames. Fully-fused GPU kernels make the inference and training fast enough for real time. A lag and a smoothing step in the feature encoding keep the cache stable.",
 "when_to_use": "Choose it for real-time path-traced GI in dynamic scenes with ray tracing and tensor-core class hardware, when predictable per-frame cost and multi-bounce light matter more than exactness.\n\nPrefer [sharc](sharc) when you want a simple, deterministic hash-grid radiance cache with no network and lower hardware requirements. Prefer [restir-pt](restir-pt) when you want unbiased reuse rather than a biased cache. Prefer [ddgi](ddgi) for low-frequency diffuse GI without a neural network.",
 "cost": {
  "class": "heavy",
  "notes": "The paper reports interactive rates for path-traced scenes on an NVIDIA RTX-class GPU; training and inference each take around a millisecond or more at 1080p."
 },
 "failure_modes": [
  "Cache bias: the network is smooth, so sharp indirect detail and caustics are blurred and can lag lighting changes",
  "Temporal instability or flicker when training samples are sparse in a region, plus a warm-up delay on scene load",
  "Requires specialized fused GPU kernels; a naive implementation is slow",
  "Cache feeds back on itself, so a single bad prediction can persist and brighten over frames"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/3450626.3459812",
   "type": "paper",
   "title": "Real-time neural radiance caching for path tracing",
   "authors": [
    "Thomas Müller",
    "Fabrice Rousselle",
    "Jan Novák",
    "Alexander Keller"
   ],
   "year": 2021,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/3450626.3459812",
   "ids": {
    "doi": "10.1145/3450626.3459812"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450626.3459812",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450626.3459812",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450626.3459812",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450626.3459812",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450626.3459812",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "mller2021neural"
  },
  {
   "role": "implementation",
   "key": "gh:nvidia-rtx/nrc",
   "type": "code",
   "title": "NVIDIA-RTX/NRC",
   "description": "Neural Radiance Cache (NRC) Library",
   "authors": [
    "NVIDIA-RTX"
   ],
   "year": 2024,
   "venue": "GitHub",
   "url": "https://github.com/NVIDIA-RTX/NRC",
   "ids": {
    "repo": "NVIDIA-RTX/NRC"
   },
   "license": "NOASSERTION",
   "extra": {
    "stars": 56,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-10-03T16:13:06Z",
    "language": "HLSL",
    "homepage": null,
    "license_name": "Other"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIA-RTX/NRC",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "nvidiartx2024nvidia"
  }
 ],
 "presets": [
  {
   "id": "neural-radiance-caching-live",
   "title": "Neural Radiance Caching (NRC) — 1-bounce noisy PT (left) vs real-time MLP multi-bounce cache (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_CACHE_GAIN": 1.15,
    "P_LIGHT_SWEEP": 0.75,
    "P_TRAIN_VIS": 0.65,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_CACHE_GAIN = 1.15; // P Multi-Bounce GI [0.2, 2.0, 0.05]\nconst float P_LIGHT_SWEEP = 0.75; // P Dynamic Light [0.0, 2.2, 0.05]\nconst float P_TRAIN_VIS = 0.65; // P Cache Query Glow [0.0, 1.4, 0.05]\nconst float P_SPLIT = 0.48; // P 1-Bounce / NRC [0.0, 1.0, 0.02]\n\nfloat hash21(vec2 p) {\n  p = fract(p * vec2(127.1, 311.7));\n  p += dot(p, p + 34.5);\n  return fract(p.x * p.y);\n}\n\n// Multi-alcove gallery room where dynamic colored bounce light must traverse 3+ bounces into recessed corners!\nvec2 mapGallery(vec3 p) {\n  float dFloor = p.y + 0.85;\n  float dCeil = 0.85 - p.y;\n  float dLeft = p.x + 1.15;\n  float dRight = 1.15 - p.x;\n  float dBack = p.z + 1.35;\n\n  vec2 res = vec2(dFloor, 1.0);\n  if (dCeil < res.x) res = vec2(dCeil, 1.0);\n  if (dBack < res.x) res = vec2(dBack, 1.0);\n  if (dLeft < res.x) res = vec2(dLeft, 2.0);  // vivid magenta-red wall\n  if (dRight < res.x) res = vec2(dRight, 3.0); // vivid cobalt-cyan wall\n\n  // Two sculptural gallery pillars creating deep indirect shadow alcoves\n  vec3 p1 = abs(p - vec3(-0.42, -0.25, -0.35)) - vec3(0.20, 0.60, 0.22);\n  float dP1 = length(max(p1, 0.0)) + min(max(p1.x, max(p1.y, p1.z)), 0.0);\n  if (dP1 < res.x) res = vec2(dP1, 4.0);\n\n  float dOrb = length(p - vec3(0.38, -0.45, -0.22)) - 0.36;\n  if (dOrb < res.x) res = vec2(dOrb, 5.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapGallery(p + e.xyy).x - mapGallery(p - e.xyy).x,\n    mapGallery(p + e.yxy).x - mapGallery(p - e.yxy).x,\n    mapGallery(p + e.yyx).x - mapGallery(p - e.yyx).x\n  ));\n}\n\n// Smooth online-trained MLP neural radiance field approximation L_cache(x, n) for dynamic light position lPos\nvec3 evalNeuralCache(vec3 p, vec3 n, vec3 lPos, float gain) {\n  // Warm direct-bounce lobe from wall nearest the moving light\n  float leftHit = smoothstep(0.6, -0.9, lPos.x);\n  float rightHit = smoothstep(-0.6, 0.9, lPos.x);\n  vec3 bounceL = vec3(0.96, 0.22, 0.36) * (0.45 + 0.95 * leftHit) * max(dot(n, normalize(vec3(-1.15, 0.0, -0.2) - p)), 0.0);\n  vec3 bounceR = vec3(0.14, 0.66, 0.98) * (0.45 + 0.95 * rightHit) * max(dot(n, normalize(vec3(1.15, 0.0, -0.2) - p)), 0.0);\n  // Higher-order infinite-bounce diffuse ambient term queried instantaneously from NRC MLP!\n  vec3 multiBounce = mix(vec3(0.36, 0.18, 0.24), vec3(0.16, 0.28, 0.42), 0.5 + 0.5 * p.x) * (0.55 + 0.45 * n.y);\n  return (bounceL * 0.52 + bounceR * 0.52 + multiBounce * 0.55) * gain;\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  bool isNRC = screenX >= split;\n  float gain = clamp(P_CACHE_GAIN, 0.15, 2.2);\n  float sweep = iTime * max(P_LIGHT_SWEEP, 0.0);\n  float vis = clamp(P_TRAIN_VIS, 0.0, 1.5);\n\n  vec3 ro = vec3(0.0, 0.06, 2.18);\n  vec3 rd = normalize(vec3(uv, -1.36));\n\n  float t = 0.05;\n  vec2 hit = vec2(10.0, 0.0);\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapGallery(ro + rd * t);\n    if (h.x < 0.0025) { hit = vec2(t, h.y); break; }\n    t += h.x;\n    if (t > 7.0) break;\n  }\n\n  vec3 col = vec3(0.02, 0.024, 0.04);\n  if (hit.y > 0.5) {\n    vec3 p = ro + rd * hit.x;\n    vec3 n = calcNormal(p);\n\n    vec3 alb = vec3(0.76, 0.76, 0.78);\n    if (hit.y > 1.5 && hit.y < 2.5) alb = vec3(0.92, 0.18, 0.34);\n    else if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.14, 0.64, 0.94);\n    else if (hit.y > 3.5 && hit.y < 4.5) alb = vec3(0.84, 0.82, 0.78);\n    else if (hit.y > 4.5) alb = vec3(0.90, 0.84, 0.74);\n\n    // Dynamic moving spotlight sweeping between red and cyan walls\n    vec3 lPos = vec3(0.78 * sin(sweep * 0.75), 0.62, 0.25 * cos(sweep * 0.75) - 0.15);\n    vec3 toL = lPos - p;\n    float dL = length(toL);\n    vec3 lDir = toL / max(dL, 1e-4);\n\n    // Quick shadow march toward dynamic light\n    float sh = 1.0;\n    float ts = 0.04;\n    for (int s = 0; s < 16; s++) {\n      float ds = mapGallery(p + lDir * ts).x;\n      if (ds < 0.004) { sh = 0.0; break; }\n      ts += max(ds, 0.04);\n      if (ts > dL - 0.08) break;\n    }\n\n    vec3 direct = alb * vec3(1.0, 0.95, 0.88) * max(dot(n, lDir), 0.0) * sh * (1.8 / (0.55 + dL * dL));\n    vec3 nrcGI = alb * evalNeuralCache(p, n, lPos, gain);\n\n    if (isNRC) {\n      // Right: Full multi-bounce NRC MLP cache terminates short paths with clean infinite-bounce radiance!\n      col = direct + nrcGI;\n      // Subtle animated neural-cache training suffix probe rings on floor/walls\n      float probeWave = exp(-abs(fract(length(p - lPos) * 1.4 - sweep * 0.35) - 0.5) * 32.0);\n      col += vec3(0.24, 0.94, 0.88) * probeWave * 0.14 * vis;\n    } else {\n      // Left: 1-bounce path tracing without NRC loses multi-bounce corner fill & suffers 1-spp shadow-zone noise!\n      float r1 = hash21(floor(fragCoord * 0.8) + floor(iTime * 11.0) * 0.17);\n      col = direct + nrcGI * 0.28 * mix(0.2, 1.9, r1);\n    }\n\n    // Glowing floating light sphere marker\n    float dLightOrb = length(cross(lPos - ro, rd));\n    col += vec3(1.0, 0.94, 0.80) * exp(-dLightOrb * 24.0) * 0.65;\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": "neural-radiance-caching",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T20:35:54.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6378,
      "std": 0.236,
      "min": 0.0431,
      "max": 0.9717
     },
     "image": "/specimens/neural-radiance-caching-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "sharc",
  "restir-gi",
  "path-tracing",
  "path-guiding"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "path-tracing",
   "why": "Short camera paths terminate in a cache query instead of tracing all bounces."
  }
 ],
 "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/neural-radiance-caching.json"
 },
 "solves": [
  "want path-traced global illumination in real time with few samples",
  "multi-bounce lighting too noisy at one sample per pixel",
  "dynamic scene needs learned indirect light cache",
  "need predictable per-frame cost for path tracing"
 ],
 "authority": "Müller et al., 2021",
 "url": "https://texelatlas.vercel.app/t/neural-radiance-caching/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 21.92,
  "tier": "heavy",
  "p50_ms": 0.7212,
  "p95_ms": 0.7983,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "neural-radiance-caching-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 21.69,
   "tier": "heavy",
   "p50_ms": 0.3448,
   "p95_ms": 0.3501,
   "speedup_x": 2.09,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 14.08,
   "tier": "moderate",
   "p50_ms": 0.4056,
   "p95_ms": 0.4088,
   "speedup_x": 1.78,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}