---
id: "neural-radiance-caching"
title: "Neural Radiance Caching"
aliases: [NRC]
domain: "gi"
stage: "lighting"
realtime: "realtime"
platforms: [desktop-gpu, cuda]
year_introduced: 2021
inputs: [gbuffer, mesh, material-params]
outputs: [radiance]
style: "photoreal"
dynamic: "dynamic"
cost: "heavy"
authority: "Müller et al., 2021"
url: "https://texelatlas.vercel.app/t/neural-radiance-caching/"
sources_verified_at: "2026-11-29"
---
# Neural Radiance Caching (Müller et al., 2021)

> 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.

## Reach for it when

- 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

## 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.

Each 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).

The 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 it

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.

Prefer [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

heavy — 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.
Measured GPU Weight: 21.92× baseline (heavy) — 0.7212 ms median / 0.7983 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 21.69× baseline (heavy) — 0.3448 ms median (2.09× faster on L4).
Ampere A100 scaling: 14.08× baseline (moderate) — 0.4056 ms median (1.78× faster on A100).

## 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

## Dataflow

- Inputs: gbuffer, mesh, material-params
- Outputs: radiance
- Platforms: desktop-gpu, cuda

## Presets

### Neural Radiance Caching (NRC) — 1-bounce noisy PT (left) vs real-time MLP multi-bounce cache (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_CACHE_GAIN": 1.15,
  "P_LIGHT_SWEEP": 0.75,
  "P_TRAIN_VIS": 0.65,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_CACHE_GAIN = 1.15; // P Multi-Bounce GI [0.2, 2.0, 0.05]
const float P_LIGHT_SWEEP = 0.75; // P Dynamic Light [0.0, 2.2, 0.05]
const float P_TRAIN_VIS = 0.65; // P Cache Query Glow [0.0, 1.4, 0.05]
const float P_SPLIT = 0.48; // P 1-Bounce / NRC [0.0, 1.0, 0.02]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

// Multi-alcove gallery room where dynamic colored bounce light must traverse 3+ bounces into recessed corners!
vec2 mapGallery(vec3 p) {
  float dFloor = p.y + 0.85;
  float dCeil = 0.85 - p.y;
  float dLeft = p.x + 1.15;
  float dRight = 1.15 - p.x;
  float dBack = p.z + 1.35;

  vec2 res = vec2(dFloor, 1.0);
  if (dCeil < res.x) res = vec2(dCeil, 1.0);
  if (dBack < res.x) res = vec2(dBack, 1.0);
  if (dLeft < res.x) res = vec2(dLeft, 2.0);  // vivid magenta-red wall
  if (dRight < res.x) res = vec2(dRight, 3.0); // vivid cobalt-cyan wall

  // Two sculptural gallery pillars creating deep indirect shadow alcoves
  vec3 p1 = abs(p - vec3(-0.42, -0.25, -0.35)) - vec3(0.20, 0.60, 0.22);
  float dP1 = length(max(p1, 0.0)) + min(max(p1.x, max(p1.y, p1.z)), 0.0);
  if (dP1 < res.x) res = vec2(dP1, 4.0);

  float dOrb = length(p - vec3(0.38, -0.45, -0.22)) - 0.36;
  if (dOrb < res.x) res = vec2(dOrb, 5.0);
  return res;
}

vec3 calcNormal(vec3 p) {
  vec2 e = vec2(0.0025, 0.0);
  return normalize(vec3(
    mapGallery(p + e.xyy).x - mapGallery(p - e.xyy).x,
    mapGallery(p + e.yxy).x - mapGallery(p - e.yxy).x,
    mapGallery(p + e.yyx).x - mapGallery(p - e.yyx).x
  ));
}

// Smooth online-trained MLP neural radiance field approximation L_cache(x, n) for dynamic light position lPos
vec3 evalNeuralCache(vec3 p, vec3 n, vec3 lPos, float gain) {
  // Warm direct-bounce lobe from wall nearest the moving light
  float leftHit = smoothstep(0.6, -0.9, lPos.x);
  float rightHit = smoothstep(-0.6, 0.9, lPos.x);
  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);
  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);
  // Higher-order infinite-bounce diffuse ambient term queried instantaneously from NRC MLP!
  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);
  return (bounceL * 0.52 + bounceR * 0.52 + multiBounce * 0.55) * gain;
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool isNRC = screenX >= split;
  float gain = clamp(P_CACHE_GAIN, 0.15, 2.2);
  float sweep = iTime * max(P_LIGHT_SWEEP, 0.0);
  float vis = clamp(P_TRAIN_VIS, 0.0, 1.5);

  vec3 ro = vec3(0.0, 0.06, 2.18);
  vec3 rd = normalize(vec3(uv, -1.36));

  float t = 0.05;
  vec2 hit = vec2(10.0, 0.0);
  for (int i = 0; i < 64; i++) {
    vec2 h = mapGallery(ro + rd * t);
    if (h.x < 0.0025) { hit = vec2(t, h.y); break; }
    t += h.x;
    if (t > 7.0) break;
  }

  vec3 col = vec3(0.02, 0.024, 0.04);
  if (hit.y > 0.5) {
    vec3 p = ro + rd * hit.x;
    vec3 n = calcNormal(p);

    vec3 alb = vec3(0.76, 0.76, 0.78);
    if (hit.y > 1.5 && hit.y < 2.5) alb = vec3(0.92, 0.18, 0.34);
    else if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.14, 0.64, 0.94);
    else if (hit.y > 3.5 && hit.y < 4.5) alb = vec3(0.84, 0.82, 0.78);
    else if (hit.y > 4.5) alb = vec3(0.90, 0.84, 0.74);

    // Dynamic moving spotlight sweeping between red and cyan walls
    vec3 lPos = vec3(0.78 * sin(sweep * 0.75), 0.62, 0.25 * cos(sweep * 0.75) - 0.15);
    vec3 toL = lPos - p;
    float dL = length(toL);
    vec3 lDir = toL / max(dL, 1e-4);

    // Quick shadow march toward dynamic light
    float sh = 1.0;
    float ts = 0.04;
    for (int s = 0; s < 16; s++) {
      float ds = mapGallery(p + lDir * ts).x;
      if (ds < 0.004) { sh = 0.0; break; }
      ts += max(ds, 0.04);
      if (ts > dL - 0.08) break;
    }

    vec3 direct = alb * vec3(1.0, 0.95, 0.88) * max(dot(n, lDir), 0.0) * sh * (1.8 / (0.55 + dL * dL));
    vec3 nrcGI = alb * evalNeuralCache(p, n, lPos, gain);

    if (isNRC) {
      // Right: Full multi-bounce NRC MLP cache terminates short paths with clean infinite-bounce radiance!
      col = direct + nrcGI;
      // Subtle animated neural-cache training suffix probe rings on floor/walls
      float probeWave = exp(-abs(fract(length(p - lPos) * 1.4 - sweep * 0.35) - 0.5) * 32.0);
      col += vec3(0.24, 0.94, 0.88) * probeWave * 0.14 * vis;
    } else {
      // Left: 1-bounce path tracing without NRC loses multi-bounce corner fill & suffers 1-spp shadow-zone noise!
      float r1 = hash21(floor(fragCoord * 0.8) + floor(iTime * 11.0) * 0.17);
      col = direct + nrcGI * 0.28 * mix(0.2, 1.9, r1);
    }

    // Glowing floating light sphere marker
    float dLightOrb = length(cross(lPos - ro, rd));
    col += vec3(1.0, 0.94, 0.80) * exp(-dLightOrb * 24.0) * 0.65;
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 1.0), sep);

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Combines with

- [Unidirectional Path Tracing](https://texelatlas.vercel.app/t/path-tracing.md): Short camera paths terminate in a cache query instead of tracing all bounces.

## Combination ideas

- [Toon-banded bounce light, learned live](https://texelatlas.vercel.app/ideas/stylized-bounce-radiance-cache/)

## Sources

1. [primary] Thomas Müller, Fabrice Rousselle, Jan Novák, Alexander Keller (2021) Real-time neural radiance caching for path tracing. ACM Transactions on Graphics. https://doi.org/10.1145/3450626.3459812 (verified via crossref on 2026-11-29)
2. [implementation] NVIDIA-RTX (2024) NVIDIA-RTX/NRC. https://github.com/NVIDIA-RTX/NRC License: NOASSERTION. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Neural Radiance Caching." https://texelatlas.vercel.app/t/neural-radiance-caching/ (accessed 2026-12-01).
