Chapter 8. Summed-Area Variance Shadow Maps — Andrew Lauritzen
- Source: https://developer.nvidia.com/gpugems/gpugems3/part-ii-light-and-shadows/chapter-8-summed-area-variance-shadow-maps
- Volume: GPU Gems 3
- Note: add-only excerpt for wiki ingest; images omitted; prose and key listings kept.
Summary of full chapter read
Shadow mapping (Williams 1978) has magnification/minification artifacts. Hardware filtering averages depths then does one binary compare — wrong. PCF (Reeves 1987) filters comparison results instead. VSMs (Donnelly & Lauritzen 2006) store depth and depth² so moments can be linearly filtered (mipmaps, anisotropic, SAT, MSAA).
VSM core
Moments M1, M2 → mean μ and variance σ². Chebyshev one-tailed upper bound: p_max = σ² / (σ² + (t−μ)²) when t > μ; else 1. Exact for single planar occluder/receiver. Clamp min variance for numeric stability and acne.
Bias via second moment
Use ddx/ddy of depth so M2 = Depth² + 0.25*(dx²+dy²) represents planar distribution over pixel — elegant bias without Peter Panning. Clamp derivative contribution when nearly parallel to light.
Light bleeding
Pathological multi-occluder cases cannot be exact without sampling all. Approximation: linstep(Amount, 1, p_max) removes low-intensity false penumbrae; Amount is scene-scale-independent artist parameter.
Numeric / depth metric
Prefer linear distance-to-light (or light-plane distance for directional) over post-projection z. Use 32-bit float textures.
Implementation outline
Render moments with linear metric + optional MSAA; optional separable blur; mipmaps; one filtered lookup; Chebyshev; optional bleeding reduction. Do NOT render only casters (receivers must be in distribution). Compatible with warping/partitioning (CSM/PSSM).
SAVSM
Summed-area tables (Crow 1984) give constant-time average over arbitrary rectangles — enables per-pixel filter width for soft shadows. SAT generation: line-by-line or recursive doubling. Precision burns log(W×H) bits; mitigations: bias −0.5, distribute moments into 4 components, origin-centered SAT, 32-bit int wraparound with known max filter, or doubles.
PCSS + SAVSM
Fernando 2005 PCSS: blocker search → penumbra estimate from similar triangles → filter. SAVSM replaces sparse PCF in filter step; blocker search still reintroduces depth-test bias.
Guidance
Constant filter width → blurred VSM + bleeding reduction is best. Dynamic width → SAVSM. Min filter width ≥4 often needed to hide aliasing.