---
id: "multiscale-diffusive-volumetric-fire-irradiance"
title: "Multi-Scale 3D Diffusive Volumetric Irradiance"
aliases: [diffusive fire light volumes, multi-scale volumetric light diffusion, volumetric fire irradiance grid]
domain: "gi"
stage: "lighting"
realtime: "realtime"
platforms: [webgpu, desktop-gpu]
year_introduced: 1995
inputs: [volume-density, voxels, normals]
outputs: [irradiance-probes, radiance]
style: "both"
dynamic: "dynamic"
cost: "cheap"
authority: "Stam, 1995"
url: "https://texelatlas.vercel.app/t/multiscale-diffusive-volumetric-fire-irradiance/"
sources_verified_at: "2026-11-30"
---
# Multi-Scale 3D Diffusive Volumetric Irradiance (Stam, 1995)

> Propagates emissive fire radiance through 3D smoke and surrounding surfaces by iterating extinction-attenuated diffusion across nested coarse voxel grids, deriving dominant fire direction from the volume gradient without shadow maps.

## Reach for it when

- fire and explosions do not illuminate surrounding smoke convincingly
- ray marching multi-bounce emissive volume lighting is too slow
- need soft glow spreading from flames into nearby dust clouds
- approximate volumetric indirect light on a 3d grid in real time
- emissive fluid sim looks flat without internal scattering irradiance

## How it works

Physically accurate multiple scattering inside dense fire and soot plumes is expensive to ray-trace in real time. Treating diffuse radiative transport as a **3D diffusion process** (Stam 1995; Koerner et al. 2014) turns volumetric self-illumination into a fast grid relaxation pass: each voxel injects local blackbody or flame emission and updates its stored irradiance as an extinction-attenuated average of its six face neighbors.

On a single grid, explicit diffusion advances only one cell per iteration, and per-step attenuation `l` caps effective reach to roughly `h * sqrt(1 / (6 * l))` world units. **Multi-scale diffusive irradiance** solves this by running nested lower-resolution 3D light volumes in parallel—for example, a quarter-resolution near field with soot absorption for tight inner-plume glow, paired with an eighth-resolution far field with minimal loss and open-boundary decay so warm firelight reaches distant terrain and cliffs in just a few compute dispatches.

Opaque scene geometry (ground, cliffs, shields) and the volume ray-marcher both trilinearly sample these grids. Taking finite differences of the coarse light volume supplies an approximate **dominant light direction** per point, letting normal-mapped surfaces react to moving flames with no point-light proxies or shadow passes.

## When to use it

Choose it for real-time GPU fluid fire, explosions, and lava plumes where flames must self-illuminate billowing smoke and cast soft, temporally coherent bounce light onto nearby terrain without spawning dozens of proxy lights.

Prefer [light-propagation-volumes](light-propagation-volumes) when propagating directional sunlight bounces across solid architecture using spherical harmonics. Prefer [froxel-volumetric-fog](froxel-volumetric-fog) when external spotlights and shadow maps dominate scattering in view-frustum fog. Prefer [delta-tracking](delta-tracking) offline for unbiased heterogeneous multi-scattering.

## Cost

cheap — Runs as a handful of 3D compute shader Jacobi/diffusion passes over quarter- and eighth-resolution grids, typically a fraction of the underlying fluid simulation cost.
Measured GPU Weight: 203.68× baseline (extreme) — 6.701 ms median / 6.7404 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 192.79× baseline (extreme) — 3.0653 ms median (2.19× faster on L4).
Ampere A100 scaling: 155.52× baseline (extreme) — 4.479 ms median (1.5× faster on A100).

## Failure modes

- Isotropic diffusion blurs out crisp directional shafts and hard occlusion edges behind solid obstacles unless solid blocker terms or flux limiters are injected
- Insufficient iteration count causes temporal lag as bright flame pulses ripple across the coarse grid over several frames
- Clamped boundary conditions reflect light back into the domain at grid edges, producing artificial glow near the bounding box unless open-face decay is applied
- Coarse-grid gradient directionality degrades when multiple equally bright fire lobes surround a surface, causing flattened normal-map response

## Dataflow

- Inputs: volume-density, voxels, normals
- Outputs: irradiance-probes, radiance
- Platforms: webgpu, desktop-gpu

## Presets

### Multi-Scale Diffusive Volumetric Fire Irradiance — nested 3D diffusion grid (left) vs fire-lit smoke & ruins (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_FIRE_POWER": 1.35,
  "P_SMOKE_DENS": 1.1,
  "P_DIFFUSE_RAD": 0.78,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_FIRE_POWER = 1.35; // P Fire Emission [0.4, 2.5, 0.1]
const float P_SMOKE_DENS = 1.10; // P Smoke Density [0.3, 2.2, 0.1]
const float P_DIFFUSE_RAD = 0.78; // P Diffusion Spread [0.25, 1.4, 0.05]
const float P_SPLIT = 0.48; // P Grid / Lit Split [0.0, 1.0, 0.02]

float hash31(vec3 p) {
  p = fract(p * vec3(127.1, 311.7, 74.7));
  p += dot(p, p.yzx + 19.19);
  return fract((p.x + p.y) * p.z);
}

float noise3(vec3 p) {
  vec3 i = floor(p);
  vec3 f = fract(p);
  f = f * f * (3.0 - 2.0 * f);
  return mix(
    mix(mix(hash31(i), hash31(i + vec3(1.0, 0.0, 0.0)), f.x),
        mix(hash31(i + vec3(0.0, 1.0, 0.0)), hash31(i + vec3(1.0, 1.0, 0.0)), f.x), f.y),
    mix(mix(hash31(i + vec3(0.0, 0.0, 1.0)), hash31(i + vec3(1.0, 0.0, 1.0)), f.x),
        mix(hash31(i + vec3(0.0, 1.0, 1.0)), hash31(i + vec3(1.0, 1.0, 1.0)), f.x), f.y),
    f.z
  );
}

float fbm3(vec3 p) {
  float v = 0.0, a = 0.5;
  for (int i = 0; i < 4; i++) {
    v += a * noise3(p);
    p *= 2.04;
    a *= 0.5;
  }
  return v;
}

float sdBox(vec3 p, vec3 b) {
  vec3 q = abs(p) - b;
  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}

// Stone ruins & brazier surrounding the roaring volumetric fire
vec2 mapRuins(vec3 p) {
  float dFloor = p.y + 0.65;
  vec2 res = vec2(dFloor, 1.0);
  // Stone pillar left & right archway
  float dP1 = sdBox(p - vec3(-0.98, 0.15, -0.35), vec3(0.22, 0.85, 0.24));
  float dP2 = sdBox(p - vec3(0.98, 0.15, -0.35), vec3(0.22, 0.85, 0.24));
  float dLint = sdBox(p - vec3(0.0, 0.92, -0.35), vec3(1.22, 0.14, 0.28));
  float dArch = min(min(dP1, dP2), dLint);
  if (dArch < res.x) res = vec2(dArch, 2.0);
  // Stone fire pit rim
  float dPit = max(abs(length(p.xz) - 0.44) - 0.08, abs(p.y + 0.56) - 0.11);
  if (dPit < res.x) res = vec2(dPit, 2.0);
  return res;
}

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

// Evaluate rising fire temperature & billowing smoke density at 3D point p
void evalFireSmoke(vec3 p, float sDens, out float fireT, out float smokeD) {
  vec3 flow = p - vec3(0.0, iTime * 1.15, 0.0);
  float n = fbm3(flow * 2.6);
  float r = length(p.xz + vec2(0.12 * sin(p.y * 3.0 - iTime * 2.4), 0.0));
  float yNorm = clamp((p.y + 0.58) / 1.45, 0.0, 1.0);
  float coreRad = mix(0.36, 0.06, pow(yNorm, 0.72));
  fireT = clamp((1.0 - r / max(coreRad, 0.04)) + (n - 0.42) * 0.85, 0.0, 1.0) * smoothstep(0.0, 0.12, yNorm) * smoothstep(0.75, 0.25, yNorm);

  float smokeRad = mix(0.32, 0.74, yNorm);
  float rawSmoke = clamp((1.0 - r / smokeRad) + (n - 0.45) * 0.95, 0.0, 1.0) * smoothstep(0.08, 0.32, yNorm) * smoothstep(1.0, 0.72, yNorm);
  smokeD = rawSmoke * sDens;
}

// Multi-scale 3D diffusive fire irradiance field across 3 nested Gaussian/Yukawa diffusion scales (L0 fine, L1 mid, L2 coarse)
vec3 evalDiffusiveIrradiance(vec3 p, float firePow, float diffRad) {
  vec3 fCore = vec3(0.04 * sin(iTime * 4.5), -0.22 + 0.05 * cos(iTime * 3.7), 0.0);
  vec3 fMid = vec3(-0.03 * cos(iTime * 3.1), 0.05, 0.0);
  float d0 = length(p - fCore);
  float d1 = length(p - fMid);
  // 3 nested extinction-attenuated diffusion scales
  float L0 = exp(-d0 * d0 / max(0.08 * diffRad * diffRad, 0.01));
  float L1 = exp(-d1 / max(0.42 * diffRad, 0.05));
  float L2 = exp(-d1 / max(1.15 * diffRad, 0.1));
  float flicker = 0.88 + 0.12 * sin(iTime * 9.3) * cos(iTime * 5.7);
  vec3 col0 = vec3(2.8, 1.65, 0.52) * L0;
  vec3 col1 = vec3(1.6, 0.58, 0.14) * L1 * 0.65;
  vec3 col2 = vec3(0.68, 0.20, 0.06) * L2 * 0.42;
  return (col0 + col1 + col2) * firePow * flicker;
}

vec3 blackbody(float t) {
  t = clamp(t, 0.0, 1.0);
  return mix(vec3(0.95, 0.16, 0.02), mix(vec3(1.0, 0.58, 0.10), vec3(1.0, 0.95, 0.78), smoothstep(0.45, 0.92, t)), smoothstep(0.05, 0.55, t));
}

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 sx = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool showFinal = sx >= split;

  float firePow = clamp(P_FIRE_POWER, 0.3, 2.8);
  float sDens = clamp(P_SMOKE_DENS, 0.2, 2.6);
  float diffRad = clamp(P_DIFFUSE_RAD, 0.2, 1.6);

  vec3 ro = vec3(0.28 * sin(iTime * 0.25), 0.18, 2.28);
  vec3 ta = vec3(0.0, 0.04, -0.15);
  vec3 fw = normalize(ta - ro);
  vec3 ri = normalize(cross(fw, vec3(0.0, 1.0, 0.0)));
  vec3 up = cross(ri, fw);
  vec3 rd = normalize(fw * 1.42 + ri * uv.x + up * uv.y);

  vec3 bg = mix(vec3(0.02, 0.025, 0.045), vec3(0.05, 0.07, 0.12), smoothstep(-0.2, 0.6, rd.y));
  vec3 col = bg;

  // March solid ruins first
  float tSolid = 0.05;
  float hitId = 0.0;
  for (int i = 0; i < 56; i++) {
    vec2 h = mapRuins(ro + rd * tSolid);
    if (h.x < 0.0025) { hitId = h.y; break; }
    tSolid += h.x;
    if (tSolid > 8.0) break;
  }

  if (hitId > 0.5) {
    vec3 p = ro + rd * tSolid;
    vec3 n = calcNormal(p);
    vec3 alb = (hitId < 1.5) ? vec3(0.26, 0.24, 0.22) : vec3(0.42, 0.40, 0.38);

    // Derive dominant fire direction directly from gradient of diffusive irradiance volume (no shadow maps!)
    float e = 0.05;
    float iC = dot(evalDiffusiveIrradiance(p, firePow, diffRad), vec3(0.3, 0.6, 0.1));
    vec3 gradI = vec3(
      dot(evalDiffusiveIrradiance(p + vec3(e, 0.0, 0.0), firePow, diffRad), vec3(0.3, 0.6, 0.1)) - iC,
      dot(evalDiffusiveIrradiance(p + vec3(0.0, e, 0.0), firePow, diffRad), vec3(0.3, 0.6, 0.1)) - iC,
      dot(evalDiffusiveIrradiance(p + vec3(0.0, 0.0, e), firePow, diffRad), vec3(0.3, 0.6, 0.1)) - iC
    );
    vec3 fireDir = normalize(gradI + vec3(1e-5));
    vec3 irr = evalDiffusiveIrradiance(p, firePow, diffRad);
    float ndl = 0.35 + 0.65 * max(dot(n, fireDir), 0.0);

    if (showFinal) {
      col = alb * (irr * ndl + vec3(0.04, 0.06, 0.10) * (0.5 + 0.5 * n.y));
    } else {
      // Left: Quantized multi-scale nested 3D voxel diffusion grid visualization
      float distC = length(p.xz);
      float voxRes = (distC < 0.75) ? 9.0 : 4.5;
      vec3 qP = (floor(p * voxRes) + 0.5) / voxRes;
      vec3 qIrr = evalDiffusiveIrradiance(qP, firePow, diffRad);
      vec3 fc = abs(fract(p * voxRes) - 0.5);
      float gridE = smoothstep(0.055, 0.015, min(min(0.5 - fc.x, 0.5 - fc.y), 0.5 - fc.z));
      vec3 tierCol = (distC < 0.75) ? vec3(1.0, 0.85, 0.25) : vec3(0.22, 0.88, 1.0);
      col = qIrr * 0.92 + tierCol * gridE * 0.35;
    }
  }

  // Volumetric raymarch through fire & smoke plume in front of solid surface
  float tStart = max(0.85, 0.05);
  float tEnd = min(tSolid, 3.6);
  if (tEnd > tStart) {
    float trans = 1.0;
    vec3 volAcc = vec3(0.0);
    const int STEPS = 32;
    float dt = (tEnd - tStart) / float(STEPS);
    for (int i = 0; i < STEPS; i++) {
      float tm = tStart + (float(i) + 0.5) * dt;
      vec3 mp = ro + rd * tm;
      if (abs(mp.x) < 0.9 && mp.y > -0.62 && mp.y < 0.95 && abs(mp.z) < 0.9) {
        float fT, sD;
        evalFireSmoke(mp, sDens, fT, sD);
        if (fT > 0.02 || sD > 0.02) {
          vec3 radVol = evalDiffusiveIrradiance(mp, firePow, diffRad);
          vec3 emit = blackbody(fT) * pow(fT, 1.6) * firePow * 4.8;
          vec3 scatter = radVol * vec3(0.45, 0.42, 0.40) * sD * 1.4;
          if (!showFinal) {
            // Left: Show quantized 3D voxel blocks of the fire diffusion cascade inside the plume
            vec3 qP = (floor(mp * 9.0) + 0.5) / 9.0;
            vec3 qRad = evalDiffusiveIrradiance(qP, firePow, diffRad);
            scatter = qRad * sD * 1.35;
          }
          float ext = sD * 2.6 + fT * 0.8;
          float stepT = exp(-ext * dt);
          volAcc += trans * (emit + scatter) * dt;
          trans *= stepT;
          if (trans < 0.02) break;
        }
      }
    }
    col = col * trans + volAcc;
  }

  float sep = smoothstep(0.0035, 0.0008, abs(sx - 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

- [Ray-marched Participating Media](https://texelatlas.vercel.app/t/volume-ray-marching.md): Samples the near-field diffused irradiance grid at each march step to shade dense smoke illuminated by internal flames.
- [Stable Fluids](https://texelatlas.vercel.app/t/stable-fluids.md): Consumes the advected 3D temperature and soot density fields from the gas solver as emission and extinction sources.

## Sources

1. [primary] Jos Stam (1995) Multiple scattering as a diffusion process. Eurographics. https://doi.org/10.1007/978-3-7091-9430-0_5 (verified via doi.org on 2026-11-30)
2. [primary] D. Koerner, J. Portsmouth, F. Sadlo, T. Ertl, B. Eberhardt (2014) Flux‐Limited Diffusion for Multiple Scattering in Participating Media. Computer Graphics Forum. https://doi.org/10.1111/cgf.12342 (verified via crossref on 2026-11-30)
3. [secondary] Duc Quang Nguyen, Ronald Fedkiw, Henrik Wann Jensen (2002) Physically based modeling and animation of fire. ACM Transactions on Graphics. https://doi.org/10.1145/566654.566643 (verified via doi.org on 2026-11-30)
4. [implementation] lejrimostfa (2026) lejrimostfa/force-field-vfx-threejs. https://github.com/lejrimostfa/force-field-vfx-threejs License: MIT. (verified via github on 2026-11-30)

## Cite this entry

Texel. "Multi-Scale 3D Diffusive Volumetric Irradiance." https://texelatlas.vercel.app/t/multiscale-diffusive-volumetric-fire-irradiance/ (accessed 2026-12-01).
