---
id: "deep-shadow-maps"
title: "Deep shadow maps"
aliases: [DSM, transmittance function shadow maps, deep shadows]
domain: "volumes"
stage: "visibility"
realtime: "offline"
platforms: [cpu, houdini, cuda]
year_introduced: 2000
inputs: [particles, volume-density, mesh]
outputs: [visibility-mask]
style: "photoreal"
dynamic: "both"
cost: "offline"
authority: "Lokovic & Veach, 2000"
url: "https://texelatlas.vercel.app/t/deep-shadow-maps/"
sources_verified_at: "2026-11-29"
---
# Deep shadow maps (Lokovic & Veach, 2000)

> Instead of one depth per light pixel, store a piecewise-linear transmittance curve along the light ray. It shadows hair, smoke and semi-transparent fuzzy objects with soft partial occlusion that ordinary shadow maps cannot represent.

## Reach for it when

- hair and fur shadows look hard or aliased
- smoke needs soft self shadowing in an offline render
- shadow map cannot handle semi transparent fuzzy objects
- partial occlusion from fibres or clouds is missing

## How it works

A standard shadow map stores the nearest depth, so a pixel is either lit or shadowed. A deep shadow map stores, for each light-space pixel, a function giving how much light survives at each depth along the ray.

The light renders the scene with all semi-transparent samples (hair fibres, volume slices, particles). For each pixel the samples are sorted by depth and accumulated into a transmittance function: starting at one, each opacity reduces the value. The curve is stored compactly as piecewise linear data with a bounded error, and neighbouring pixels are filtered by averaging functions rather than single depths, which gives soft shadows without noise.

At shading time the renderer transforms a point into light space, finds the function and evaluates it at the point's depth. Visibility is the evaluated transmittance. Because the function is filtered across a pixel footprint, thin hair strands produce stable partial shadow instead of aliasing.

## When to use it

Choose it in offline renderers for hair, fur, smoke, clouds and dense particle effects where self-shadowing must be smooth and film-quality.

Prefer [shadow-mapping](shadow-mapping) or [percentage-closer-filtering](percentage-closer-filtering) for opaque geometry. Prefer [variance-shadow-maps](variance-shadow-maps) or [moment-shadow-maps](moment-shadow-maps) for real-time soft shadows of opaque or alpha-tested objects. Prefer [froxel-volumetric-fog](froxel-volumetric-fog) and [volume-ray-marching](volume-ray-marching) in real time for fog and clouds, which compute transmittance directly. Prefer [ray-traced-shadows](ray-traced-shadows) or [delta-tracking](delta-tracking) when a path tracer can estimate transmittance per shading point.

## Cost

offline — Build time and memory scale with the number of semi-transparent samples per light pixel; lookup is a search along one stored function.
Measured GPU Weight: 508.83× baseline (extreme) — 16.7405 ms median / 17.1646 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 470.59× baseline (extreme) — 7.4824 ms median (2.24× faster on L4).
Ampere A100 scaling: 405.19× baseline (extreme) — 11.6695 ms median (1.43× faster on A100).

## Failure modes

- Memory grows with depth complexity, so dense hair or volumes need aggressive compression of the transmittance curves
- Light bleeding and wrong shadows if the compression tolerance is too coarse for thin dense layers
- Resolution tied to the light's pixel grid, so close-up views need higher resolution or tiling
- One map per light, which makes many-light scenes expensive
- Moving objects require rebuilding the map every frame
- Surface and volume samples need consistent opacity conventions, otherwise self-shadow offsets show as dark bands

## Dataflow

- Inputs: particles, volume-density, mesh
- Outputs: visibility-mask
- Platforms: cpu, houdini, cuda

## Presets

### Deep Shadow Maps — hard binary single-depth shadow map (left) vs piecewise volumetric transmittance curve (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_OPTICAL_DEPTH": 1.65,
  "P_LIGHT_ANGLE": 0.55,
  "P_PLUME_TURB": 0.72,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_OPTICAL_DEPTH = 1.65; // P Optical Depth [0.4, 3.2, 0.1]
const float P_LIGHT_ANGLE = 0.55; // P Light Elevation [0.15, 1.2, 0.05]
const float P_PLUME_TURB = 0.72; // P Cloud Wisps [0.2, 1.4, 0.05]
const float P_SPLIT = 0.48; // P Binary / Deep SM 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;
}

// Semi-transparent swirling volumetric plume hovering above a stone floor
float evalCloudDensity(vec3 p, float turb) {
  vec3 c = p - vec3(0.0, 0.24, -0.18);
  float r = length(c * vec3(0.85, 1.18, 0.92));
  if (r > 0.92) return 0.0;
  float n = fbm3(c * 2.8 + vec3(iTime * 0.22, -iTime * 0.14, 0.0));
  float base = smoothstep(0.82, 0.16, r) + (n - 0.5) * turb * 0.85;
  return clamp(base, 0.0, 1.0) * smoothstep(0.88, 0.52, r);
}

// Integrate transmittance along light ray from p toward lDir (Deep Shadow Map T(z) vs Binary single-depth threshold!)
float evalLightTrans(vec3 p, vec3 lDir, float optD, float turb, bool useDSM) {
  float acc = 0.0;
  bool hitBinary = false;
  float ds = 0.085;
  for (int i = 0; i < 14; i++) {
    vec3 q = p + lDir * (float(i) + 0.5) * ds;
    float d = evalCloudDensity(q, turb);
    if (d > 0.22) hitBinary = true;
    acc += d * ds;
  }
  if (useDSM) {
    // Deep Shadow Map: smooth continuous Beer-Lambert transmittance function T(z) = exp(-sigma * integral)
    return exp(-acc * optD * 2.8);
  }
  // Standard single-depth shadow map: binary 0/1 cutoff at alpha-test depth threshold!
  return hitBinary ? 0.06 : 1.0;
}

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 useDSM = sx >= split;

  float optD = clamp(P_OPTICAL_DEPTH, 0.2, 4.0);
  float lAng = clamp(P_LIGHT_ANGLE, 0.1, 1.4);
  float turb = clamp(P_PLUME_TURB, 0.1, 1.6);

  vec3 lDir = normalize(vec3(cos(lAng) * 0.65, sin(lAng) + 0.45, 0.48));
  vec3 ro = vec3(0.25 * sin(iTime * 0.24), 0.36, 2.25);
  vec3 ta = vec3(0.0, -0.06, -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 sky = mix(vec3(0.64, 0.74, 0.88), vec3(0.16, 0.32, 0.62), smoothstep(-0.08, 0.55, rd.y));
  vec3 col = sky;

  // Floor plane y = -0.62 catching cast volumetric shadow
  float tMax = 6.0;
  if (rd.y < -0.005) {
    float tf = (-0.62 - ro.y) / rd.y;
    if (tf > 0.05 && tf < 14.0) {
      tMax = tf;
      vec3 fp = ro + rd * tf;
      vec2 tile = floor(fp.xz * 2.2);
      vec3 alb = mix(vec3(0.58, 0.56, 0.52), vec3(0.72, 0.70, 0.66), mod(tile.x + tile.y, 2.0));
      float sh = evalLightTrans(fp + vec3(0.0, 0.02, 0.0), lDir, optD, turb, useDSM);
      col = alb * (vec3(1.25, 1.12, 0.94) * max(lDir.y, 0.1) * sh + vec3(0.20, 0.26, 0.38));
      col = mix(col, sky, 1.0 - exp(-tf * 0.08));
    }
  }

  // Raymarch the floating wispy cloud volume with self-shadowing from Binary SM vs Deep Shadow Map!
  float t0 = max(0.75, 0.05);
  float t1 = min(tMax, 3.55);
  if (t1 > t0) {
    float trans = 1.0;
    vec3 volCol = vec3(0.0);
    const int STEPS = 32;
    float dt = (t1 - t0) / float(STEPS);
    float hg = 0.25 + 0.75 * pow(max(dot(rd, lDir), 0.0), 4.0);
    for (int i = 0; i < STEPS; i++) {
      vec3 mp = ro + rd * (t0 + (float(i) + 0.5) * dt);
      float d = evalCloudDensity(mp, turb);
      if (d > 0.01) {
        float lTrans = evalLightTrans(mp, lDir, optD, turb, useDSM);
        vec3 lit = vec3(1.45, 1.24, 0.96) * lTrans * (0.6 + 0.75 * hg) + vec3(0.24, 0.34, 0.52) * (0.5 + 0.5 * mp.y);
        float ext = d * optD * 2.2;
        float stepT = exp(-ext * dt);
        volCol += trans * lit * (1.0 - stepT);
        trans *= stepT;
        if (trans < 0.02) break;
      }
    }
    col = col * trans + volCol;
  }

  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.

## Lineage

- extends [Shadow Mapping](https://texelatlas.vercel.app/t/shadow-mapping.md)

## Combines with

- [OpenVDB](https://texelatlas.vercel.app/t/openvdb.md): Volume density grids are sampled along light rays to generate the transmittance functions.
- [Ray-marched Participating Media](https://texelatlas.vercel.app/t/volume-ray-marching.md): The marcher reads the deep shadow map to attenuate in-scattered light at each step.

## Sources

1. [primary] Tom Lokovic, Eric Veach (2000) Deep shadow maps. Proceedings of the 27th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '00. https://doi.org/10.1145/344779.344958 (verified via crossref on 2026-11-29)
2. [primary] Jon Jansen, Louis Bavoil (2010) Fourier opacity mapping. Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games. https://doi.org/10.1145/1730804.1730831 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Deep shadow maps." https://texelatlas.vercel.app/t/deep-shadow-maps/ (accessed 2026-12-01).
