CSCE 441 Lecture 33
« previous | Friday, April 11, 2014 | next »
Shadow Maps (cont'd)
Advantages:
- simple to implement
- Does not depend on scene complexity (except to render the map)
Disadvantages
- Fixed resolution leads to artifacts.
- shadow maps are limited by screen resolution and depend on object distance
Anatomy of a Shadow
Shadows independent of viewer location
Silhouette of shadowing object generates a volume (the shadow volume)
Shadow Volumes
Build polygons for shadow volumes explicitly
Render shadow volume from viewer's perspctive and count whether inside or outside a shadow.
- When entering a shadow volume,
counter++
- When exiting a shadow volume,
counter--
- If
counter > 0
, we're in a shadow.
To build,
- find silhouette edges for each surface
- build volume by extending away from light
- use stencil buffer to count intersections with shadow volume
- Render front faces and increment if closer to viewer
- Render back faces and decrement if closer to viewer
- Don't update color or depth values!!!
- If stencil buffer is non-zero, then the pixel is in shadow.
Problems
Clipping planes are used to set bounds for depth rendering.
- Polygons will be clipped to what is between the clipping planes and inside the view frustum.
- If shadow volume is clipped, we could reach a point where we never enter a shadow, but will exit somewhere.
If the eye starts in a shadow volume, then an entire shadow may not be rendered correctly.
Summary
Advantages
- omnidirectional lights
- proper self-shadowing behavior
- pixel-perfect shadows
Disadvantages
- surfaces can only use planar polygons
- Silhouette computation uses CPU
- Heavy on fill-rate (buffer updated every time we enter and leave a shadow volume for every pixel.
- Near/far clipping planes can lead to problems
Soft Shadows
Point lights cause hard shadows
Lights are not infinitely small points in reality. Rather, they are area lights; these generate soft shadows.
We can simulate area lights by generating a lot of point lights. (expensive!)
We could also blur shadows in image space (cheap), but this looks totally fake.