1 of 21

Shadows

CSC 476

Zoë Wood / Ian Dunn

2 of 21

Shadows

Reveal spatial relationships

3 of 21

Shadow Terminology

Occluders

Umbra

Penumbra

4 of 21

Real-Time Shadow Techniques

  • Planar shadows
  • Shadow volumes
  • Shadow maps

Andrew Wyeth

5 of 21

Planar shadows

  • Projection shadow
    • Squash polygons onto plane
    • Depth issues

6 of 21

Projective textures

  • Using projective textures (for planar shadows) – general idea:

Done in shader of

affected object

7 of 21

Shadow volumes (skirts)

  • Shadow volumes
    • Compute shadow volumes
    • At render determine if fragment in or out of shadow volumes

8 of 21

Shadow Volumes - Generation

  • Determine silhouettes
    • Edges of triangles
    • Dot geometric normals
      • Sign changes

9 of 21

Shadow Volumes - Generation

  • Extrude edges towards infinity
    • Away from light source
  • Where?
    • CPU
    • Slow if changing per frame!
    • GPU - geometry shaders

10 of 21

Shadow maps

  • Shadow maps
    • Render scene from light’s perspective
    • Use depth values to find occluders

11 of 21

Shadow Maps

12 of 21

Shadow Maps - Steps

  1. Determine light parameters
  2. Render with light camera
  3. Render with usual camera
    1. Transform to light space (light ndc)
    2. Sample depth from shadow map
    3. Compare sampled and transformed depth

13 of 21

Shadow Maps

Light Parameters? See everything that casts shadows

Constrain this!

14 of 21

Shadow Maps

Light matrix = Lp * Lv

Want: Light NDC - how and why?

15 of 21

Shadow Acne

Bias = peter panning

16 of 21

Shadow Maps - Problems

  • Shadowing determined per-fragment
  • Shadow map texels =/= fragments

17 of 21

Shadow Maps

Ideally - one shadow texel = one fragment

Projection transform makes this difficult

Projection transform of the viewer

18 of 21

Cascaded Shadow Maps

19 of 21

Percentage Closer Filtering

  • Not true/false
  • Measure the percentage of closer texels

Trade-off: sample count vs. performance

20 of 21

What about soft shadows?

These are still hard shadows

21 of 21

Percentage Closer Soft Shadows

  • Simple method to better approximate soft shadows

  • Increase shadow map�search radius when�far from occluder