Shadow mapping is an image-space two-pass algorithm to generate shadows. The first pass generates depth value from light source to a “depth texture.” And the second pass reproject world space position to the depth texture, and compare the depth value to decide whether a point is in shadow.
Downside of Shadow Mapping
There are several downside of the shadow map.
- You need to have one shadow map per light source
- It is easy to have aliasing effect (especially for low resolution shadow maps)
- self-occlusion problem can happen
There are several techniques to mitigate those problems:
- percentage closer filtering (PCF) helps with aliasing
We can employ a depth bias to combat self-occlusion, but it can also introduces Peter panning effect:
Extension to Shadow Maps
Anti-Aliasing
Splitting
Soft Shadows
- percentage closer soft shadow (PCSS) create soft shadows (based on PCF)
- variance shadow mapping greatly reduce the texture sampling cost of PCF
- moment shadow mapping solves some problem with VSM