Robust Shadow Maps for Large Environments Daniel Scherzer
Robust Shadow Maps for Large Environments Daniel Scherzer Institute of Computer Graphics and Algorithms Vienna University of Technology
Motivation: The Challenge Huge and dynamic environments More than 100, 000 visible triangles Automatic shadow generation No artifacts? Daniel Scherzer 1
Motivation: Why Shadow Maps? Independent of scene complexity Not 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 2
Shadow Map Algorithm: Second First Pass Light Eye-view Shadow map Render scene from light-view and save depth values Render scene from eye-view Transform each fragment to light source space Compare zeye with zlight value stored in shadow map zeye > zlight fragment is in shadow Daniel Scherzer 3
Problem: Perspective aliasing Sufficient resolution far from the observer Insufficient resolution near the observer Daniel Scherzer okay 4 aliased
Problem: Projection aliasing Receivers ~ perpendicular to shadow plane Daniel Scherzer 5
Problem: Self-(un)shadowing Polygon Observers‘s distance > shadow depth Incorrect self-shadowing Daniel Scherzer 6
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 7
Solution: Perspective aliasing Insufficient resolution near the observer aliased okay Daniel Scherzer 8
Solution: Perspective aliasing Insufficient resolution near the observer Redistribute shadow map samples Daniel Scherzer 9
Solution: Perspective aliasing Sufficient resolution near the observer Redistribute shadow map samples still okay Daniel Scherzer okay now 10
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 [WSP 2004] M. Wimmer, D. Scherzer, and W. Purgathofer; Light space perspective shadow maps; In Proceedings of Eurographics Symposium on Rendering 2004 Daniel Scherzer 11
Solution: Projection aliasing Receivers ~ perpendicular to shadow plane Redistribution doesn‘t work But! Daniel Scherzer 12
Solution: Projection aliasing Diffuse lighting: I = IL max( dot( L, N ), 0 ) ~ perpendicular receivers have small I Dark Hides artefacts! L Daniel Scherzer 13 N
Solution: Projection aliasing Guidelines for the lightsource Small ambient term Diffuse is good for hiding artefacts Specular is no problem Light direction and view direction nearly the same Resolution in shadow map suffices Daniel Scherzer 14
Solution: Projection aliasing Screen-space blur of shadows Hides artefacts Shadows get softer Daniel Scherzer 15
Problem: Self-(un)shadowing Polygon Biased polygon Observer‘s distance < shadow depth Self-shadowing eliminated Observers‘s distance > shadow depth Incorrect self-shadowing Daniel Scherzer 16
Solution: Self-(un)shadowing How do we choose the bias? No biasing Constant biasing Slope-scale biasing Daniel Scherzer 17
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 biasing On the post-projective Z-slope Or calculate linear Z with vertex shader Daniel Scherzer 18
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 19
Conclusions Cause Sample Solution Perspective aliasing Perspective Transformation (Lisp. SM) Projection aliasing Blurring, lightmodel Self-(un) shadowing Biasing, backside rendering Daniel Scherzer 20 Sample
Putting It All Together Daniel Scherzer 21
- Slides: 22