Robust Shadow Maps for Large Environments
Daniel Scherzer
Institute of Computer Graphics and Algorithms
Vienna University of Technology
Daniel Scherzer 2
Motivation: The Challenge
Huge and dynamic environments
More than 100,000 visible triangles
Automatic shadow generation
No artifacts?
Daniel Scherzer 3
Motivation: Why Shadow Maps?
Independent of scene complexityNot as fill-rate limited with many polygons as shadow volumes
Only one additional (depth only) render pass
Handle self-shadowing correctly
Handle arbitrary caster/receiver constellations
Daniel Scherzer 4
Shadow Map Algorithm: Second Pass
EyeLight
Render scene from light-view and save depth values
Render scene from eye-viewTransform each fragment to light source space
Compare zeye with zlight value stored in shadow map
zeye > zlight fragment is in shadow
Shadow Map Algorithm: First Pass
Shadow mapEye-view
Daniel Scherzer 5
Problem: Perspective aliasing
Sufficient resolution far from the observer
Insufficient resolution near the observer
aliasedokay
Daniel Scherzer 6
Problem: Projection aliasing
Receivers ~ perpendicular to shadow plane
Daniel Scherzer 7
Problem: Self-(un)shadowing
Observers‘s distance > shadow depthIncorrect self-shadowing
Polygon
Daniel Scherzer 8
Problems of Shadow Maps
Cause Sample Error
Perspective aliasing
Insufficient resolution near the observer
Projection aliasing
Insufficient resolution on polygons almost parallel to the light direction
Self-(un) shadowing
Moiré-patterns
Daniel Scherzer 9
Solution: Perspective aliasing
Insufficient resolution near the observer
aliasedokay
Daniel Scherzer 10
Solution: Perspective aliasing
Insufficient resolution near the observerRedistribute shadow map samples
Daniel Scherzer 11
Solution: Perspective aliasing
Sufficient resolution near the observerRedistribute shadow map samples
still okay okay now
Daniel Scherzer 12
Solution: Perspective aliasing
How do we redistribute the shadow map samples?
Using a perspective transformation
Just another perspective matrix
During shadow map generation
During rendering
For further details see
[WSP2004][WSP2004] M. Wimmer, D. Scherzer, and W. Purgathofer; Light space perspective shadow maps; In Proceedings of Eurographics Symposium on Rendering 2004
Daniel Scherzer 13
Solution: Projection aliasing
Receivers ~ perpendicular to shadow plane
Redistribution doesn‘t work
But!
Daniel Scherzer 14
Solution: Projection aliasing
Diffuse lighting: I = IL max( dot( L, N ), 0 )
~ perpendicular receivers have small I
Dark Hides artefacts!
LN
Daniel Scherzer 15
Solution: Projection aliasing
Guidelines for the light- source
Small ambient term
Diffuse is good for hiding artefacts
Specular is no problemLight direction and view direction nearly the same
Resolution in shadow map suffices
Daniel Scherzer 16
Solution: Projection aliasing
Screen-space blur of shadows
Hides artefacts
Shadows get softer
Daniel Scherzer 17
Problem: Self-(un)shadowing
Observers‘s distance > shadow depthIncorrect self-shadowing
Polygon
Biased polygon
Observer‘s distance < shadow depthSelf-shadowing eliminated
Daniel Scherzer 18
Solution: Self-(un)shadowing
How do we choose the bias?
Slope-scale biasing
Constant biasing
No biasing
Daniel Scherzer 19
Solution: Self-(un)shadowing
How do we choose the bias?
Perspective Z is hyperbolic, not linear!
Normal Slope-scale doesn’t work
Do slope-scale biasingOn the post-projective Z-slope
Or calculate linear Z with vertex shader
Daniel Scherzer 20
Solution: Self-(un)shadowing
Other possibility to avoid self-shadowing:
Normally we use the front-side polygons
Now we use the back-side polygons
Daniel Scherzer 21
Conclusions
Cause Sample Solution Sample
Perspective aliasing
Perspective Transformation (LispSM)
Projection aliasing
Blurring, light-model
Self-(un) shadowing
Biasing, back-side rendering
Daniel Scherzer 22
Putting It All Together
Top Related