---
id: "cascaded-shadow-maps"
title: "Cascaded Shadow Maps"
domain: "visibility"
stage: "visibility"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2006
inputs: [mesh, depth]
outputs: [visibility-mask]
style: "both"
dynamic: "dynamic"
cost: "medium"
authority: "Zhang et al., 2006"
url: "https://texelatlas.vercel.app/t/cascaded-shadow-maps/"
sources_verified_at: "2026-11-29"
---
# Cascaded Shadow Maps (Zhang et al., 2006)

> Splits the camera frustum into depth slices and gives each slice its own shadow map, so near surfaces get high texel density without exploding total resolution.

## Reach for it when

- shadows look blocky or pixelated far from the camera
- one shadow map can't cover a large outdoor scene
- sun shadows lose resolution in big open worlds
- near shadows blurry while the view distance is huge

## How it works

The view frustum is divided along depth into typically three to five cascades, with split planes chosen logarithmically, uniformly or by a blend of both (practical split scheme). For each slice an orthographic light-space projection is fitted around that sub-frustum and rendered into one layer of an array texture or atlas. At shading time the fragment's view depth selects a cascade, and the result is blended across a transition band to hide seams. Stabilisation snaps the projection to texel increments so shadows do not shimmer as the camera rotates, and tight depth-range fitting or sample-distribution analysis (SDSM) shrinks each map further.

## When to use it

Choose it for sun or moon light in open scenes with a long view distance. Prefer [Virtual Shadow Maps](https://texelatlas.vercel.app/t/virtual-shadow-maps.md) when you need uniform sharp detail across the whole view with massive geometry, [Shadow Mapping](https://texelatlas.vercel.app/t/shadow-mapping.md) with a single map for small enclosed scenes, and [Ray-Traced Shadows](https://texelatlas.vercel.app/t/ray-traced-shadows.md) if hardware ray tracing replaces the sun map entirely.

## Cost

medium — Each cascade re-renders casters, so draw cost is roughly cascade count times the caster pass, mitigated by culling per cascade and updating far cascades less often.
Measured GPU Weight: 65.4× baseline (extreme) — 2.1515 ms median / 2.211 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 64.86× baseline (extreme) — 1.0312 ms median (2.09× faster on L4).
Ampere A100 scaling: 41.89× baseline (heavy) — 1.2063 ms median (1.78× faster on A100).

## Failure modes

- Visible seams or resolution jumps at cascade borders
- Shadow swimming and shimmering when the fit is not stabilised
- Wasted resolution in the nearest cascade for oblique light directions
- Peter-panning near the camera from large biases chosen for far cascades

## Engine support

- babylonjs: builtin — `new BABYLON.CascadedShadowGenerator(1024, directionalLight); csm.numCascades = 4` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Lights/Shadows/cascadedShadowGenerator.pure.ts, checked 2026-12-01) — DirectionalLight only.
- godot: builtin — `DirectionalLight3D.directional_shadow_mode = DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/DirectionalLight3D.xml, checked 2026-12-01)
- threejs: official — `import { CSM } from 'three/addons/csm/CSM.js' (WebGPU: CSMShadowNode)` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/csm/CSM.js, checked 2026-12-01)
- unity: builtin — `URP Asset > Shadows > Cascade Count; HDRP Volume > Shadows > Cascade Count` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md, checked 2026-12-01) — Directional light cascades in URP and HDRP.
- unreal: builtin — `Directional Light > Cascaded Shadow Maps category (Dynamic Shadow Distance, Num Dynamic Shadow Cascades)` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/directional-lights-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: mesh, depth
- Outputs: visibility-mask
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot

## Presets

### 4-cascade Practical Split Scheme shadows — quantized cascade texel footprints and PCF (glsl-fragment; rendered 2026-11-30)

```json
{
  "SPLIT_LAMBDA": 0.65,
  "PCF_RADIUS": 1.25,
  "CASCADE_TINT": 0.38,
  "SUN_ANGLE": 0.72
}
```

```glsl
const float SPLIT_LAMBDA = 0.65; // P
const float PCF_RADIUS = 1.25; // P
const float CASCADE_TINT = 0.38; // P
const float SUN_ANGLE = 0.72; // P

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);
}

float mapCasters(vec3 p) {
  // Receding rows of architectural monoliths and lintel arches
  vec3 q = p;
  q.z = mod(q.z + 1.8, 3.6) - 1.8;
  float pL = sdBox(vec3(p.x + 1.55, p.y - 1.05, q.z), vec3(0.32, 1.05, 0.32));
  float pR = sdBox(vec3(p.x - 1.55, p.y - 1.05, q.z), vec3(0.32, 1.05, 0.32));
  float arch = sdBox(vec3(p.x, p.y - 2.05, q.z), vec3(1.88, 0.22, 0.28));
  // Center obelisk row with varying heights
  float id = floor((p.z + 1.8) / 3.6);
  float h = 0.55 + 0.35 * sin(id * 1.9);
  float ob = sdBox(vec3(p.x - 0.35 * sin(id * 2.3), p.y - h, q.z - 0.8), vec3(0.22, h, 0.22));
  return min(min(pL, pR), min(arch, ob));
}

float mapScene(vec3 p) {
  return min(p.y, mapCasters(p));
}

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

// Shadow test snapped to cascade light-space texel grid
float traceCaster(vec3 ro, vec3 rd) {
  float t = 0.04;
  for (int i = 0; i < 28; i++) {
    float d = mapCasters(ro + rd * t);
    if (d < 0.006) return 0.0;
    t += max(d, 0.04);
    if (t > 14.0) break;
  }
  return 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;
  vec3 ro = vec3(0.0, 2.35, 3.2);
  vec3 rd = normalize(vec3(uv.x, uv.y - 0.24, -1.25));

  float sunAz = SUN_ANGLE + 0.35 * sin(iTime * 0.4);
  if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
    sunAz = (iMouse.x / iResolution.x) * 2.4 - 0.5;
  }
  vec3 sunDir = normalize(vec3(cos(sunAz), 0.72, sin(sunAz) * 0.65));
  vec3 lRight = normalize(cross(sunDir, vec3(0.0, 1.0, 0.0)));
  vec3 lUp = cross(lRight, sunDir);

  float t = 0.1;
  bool hit = false;
  for (int i = 0; i < 72; i++) {
    float d = mapScene(ro + rd * t);
    if (d < 0.004) { hit = true; break; }
    t += d;
    if (t > 38.0) break;
  }

  vec3 sky = mix(vec3(0.68, 0.78, 0.90), vec3(0.18, 0.36, 0.68), clamp(uv.y + 0.35, 0.0, 1.0));
  vec3 col = sky;
  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = calcNormal(p);
    // Practical split scheme (Zhang et al. 2006) across 4 cascades in [zNear, zFar]
    float zNear = 1.2, zFar = 34.0;
    float lam = clamp(SPLIT_LAMBDA, 0.0, 1.0);
    float s1 = mix(zNear + (zFar - zNear) * 0.25, zNear * pow(zFar / zNear, 0.25), lam);
    float s2 = mix(zNear + (zFar - zNear) * 0.50, zNear * pow(zFar / zNear, 0.50), lam);
    float s3 = mix(zNear + (zFar - zNear) * 0.75, zNear * pow(zFar / zNear, 0.75), lam);

    float viewZ = -dot(p - ro, vec3(0.0, 0.0, -1.0));
    int casc = (viewZ < s1) ? 0 : (viewZ < s2) ? 1 : (viewZ < s3) ? 2 : 3;
    float texel = (casc == 0) ? 0.045 : (casc == 1) ? 0.11 : (casc == 2) ? 0.24 : 0.48;
    vec3 cTint = (casc == 0) ? vec3(0.28, 0.92, 0.58) : (casc == 1) ? vec3(0.32, 0.72, 1.0) : (casc == 2) ? vec3(1.0, 0.78, 0.28) : vec3(0.98, 0.42, 0.38);

    // Quantize light-space coordinates to cascade texel size + 4-tap PCF
    vec3 pOff = p + n * (0.015 + texel * 0.25);
    vec2 luv = vec2(dot(pOff, lRight), dot(pOff, lUp));
    vec2 qBase = (floor(luv / texel) + 0.5) * texel;
    float pcfR = max(PCF_RADIUS, 0.0) * texel;
    float vis = 0.0;
    vec2 offs[4];
    offs[0] = vec2(-0.5, -0.5); offs[1] = vec2(0.5, -0.5);
    offs[2] = vec2(-0.5,  0.5); offs[3] = vec2(0.5,  0.5);
    for (int k = 0; k < 4; k++) {
      vec2 tap = qBase + offs[k] * pcfR;
      vec3 sp = pOff + lRight * (tap.x - luv.x) + lUp * (tap.y - luv.y);
      vis += traceCaster(sp, sunDir);
    }
    vis *= 0.25;

    // Subtle border line at exact cascade split planes
    float dSplit = min(min(abs(viewZ - s1), abs(viewZ - s2)), abs(viewZ - s3));
    float splitLine = smoothstep(0.14, 0.02, dSplit) * clamp(CASCADE_TINT, 0.0, 1.0);

    vec2 tile = floor(p.xz * 1.25);
    float chk = mod(tile.x + tile.y, 2.0);
    vec3 baseAlb = (p.y < 0.01) ? mix(vec3(0.42, 0.44, 0.46), vec3(0.62, 0.63, 0.64), chk) : vec3(0.74, 0.71, 0.67);
    vec3 alb = mix(baseAlb, baseAlb * cTint * 1.35, clamp(CASCADE_TINT, 0.0, 1.0));
    float nl = max(dot(n, sunDir), 0.0);
    vec3 lit = alb * (vec3(0.16, 0.22, 0.34) + vec3(1.55, 1.42, 1.22) * nl * vis);
    lit = mix(lit, vec3(1.0), splitLine * 0.65);
    col = mix(lit, sky, 1.0 - exp(-0.022 * t));
  }
  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)
- extended by [Sample Distribution Shadow Maps (SDSM)](https://texelatlas.vercel.app/t/sample-distribution-shadow-maps.md)

## Sources

1. [primary] Fan Zhang, Hanqiu Sun, Leilei Xu, Lee Kit Lun (2006) Parallel-split shadow maps for large-scale virtual environments. Proceedings of the 2006 ACM international conference on Virtual reality continuum and its applications. https://doi.org/10.1145/1128923.1128975 (verified via crossref on 2026-11-29)
2. [tutorial] Rouslan Dimitrov Cascaded Shadow Maps. developer.download.nvidia.com. https://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf (verified via http on 2026-11-29)
3. [implementation] mrdoob (2010) mrdoob/three.js. https://github.com/mrdoob/three.js License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Cascaded Shadow Maps." https://texelatlas.vercel.app/t/cascaded-shadow-maps/ (accessed 2026-12-01).
