Deep shadow maps
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.
Also known as DSM, transmittance function shadow maps, deep shadows
In the family Atmosphere, water & volumes, volumetric shadows
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | Not offered; Virtual Shadow Maps are different. |
| Blender 5.2 | None found | Not offered. |
| WebGPU W3C | None found | |
| Metal | None found |
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 choose it
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
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 or Percentage-Closer Filtering for opaque geometry. Prefer Variance Shadow Maps or Moment Shadow Maps for real-time soft shadows of opaque or alpha-tested objects. Prefer Froxel Volumetric Fog and Ray-marched Participating Media in real time for fog and clouds, which compute transmittance directly. Prefer Ray-Traced Shadows or Delta (Woodcock) Tracking when a path tracer can estimate transmittance per shading point.
Field marks
- 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
Presets
Deep Shadow Maps — hard binary single-depth shadow map (left) vs piecewise volumetric transmittance curve (right)
{
"P_OPTICAL_DEPTH": 1.65,
"P_LIGHT_ANGLE": 0.55,
"P_PLUME_TURB": 0.72,
"P_SPLIT": 0.48
}Show GLSL (133 lines)
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.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| deep-shadow-maps-live | Tesla T4 1920x1080 | 509× baseline (extreme) · 16.7 ms / 17.2 ms | opengl-timer-query · 16 frames · GPU Weight Atlas · Colab T4 sweep |
| deep-shadow-maps-live | NVIDIA L4 1920x1080 | 471× baseline (extreme) · 7.48 ms / 7.59 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| deep-shadow-maps-live | NVIDIA A100-SXM4-40GB 1920x1080 | 405× baseline (extreme) · 11.7 ms / 11.8 ms · 1.4× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Cascaded Shadow Maps, Delta (Woodcock) Tracking, Disney / Chiang hair and fur BSDF, Marschner hair scattering model, Multiple-Scattering Approximation by Octaves, Precomputed Radiance Transfer, Ray-marched Participating Media.
Crosses
- OpenVDB: Volume density grids are sampled along light rays to generate the transmittance functions.
- Ray-marched Participating Media: The marcher reads the deep shadow map to attenuate in-scattered light at each step.
Sources
- primaryTom Lokovic, Eric Veach (2000). Deep shadow maps. Proceedings of the 27th annual conference on Computer graphics and interactive techniques - SIGGRAPH '00.Verified via crossref · 2026-11-29doi:10.1145/344779.344958
- primaryJon Jansen, Louis Bavoil (2010). Fourier opacity mapping. Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games.Verified via crossref · 2026-11-29doi:10.1145/1730804.1730831