Robust Shadow Maps for Large Environments

22
Robust Shadow Maps for Large Environments Daniel Scherzer Institute of Computer Graphics and Algorithms Vienna University of Technology

description

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?. - PowerPoint PPT Presentation

Transcript of Robust Shadow Maps for Large Environments

Page 1: Robust Shadow Maps for Large Environments

Robust Shadow Maps for Large Environments

Daniel Scherzer

Institute of Computer Graphics and Algorithms

Vienna University of Technology

Page 2: Robust Shadow Maps for Large Environments

Daniel Scherzer 2

Motivation: The Challenge

Huge and dynamic environments

More than 100,000 visible triangles

Automatic shadow generation

No artifacts?

Page 3: Robust Shadow Maps for Large Environments

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

Page 4: Robust Shadow Maps for Large Environments

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

Page 5: Robust Shadow Maps for Large Environments

Daniel Scherzer 5

Problem: Perspective aliasing

Sufficient resolution far from the observer

Insufficient resolution near the observer

aliasedokay

Page 6: Robust Shadow Maps for Large Environments

Daniel Scherzer 6

Problem: Projection aliasing

Receivers ~ perpendicular to shadow plane

Page 7: Robust Shadow Maps for Large Environments

Daniel Scherzer 7

Problem: Self-(un)shadowing

Observers‘s distance > shadow depthIncorrect self-shadowing

Polygon

Page 8: Robust Shadow Maps for Large Environments

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

Page 9: Robust Shadow Maps for Large Environments

Daniel Scherzer 9

Solution: Perspective aliasing

Insufficient resolution near the observer

aliasedokay

Page 10: Robust Shadow Maps for Large Environments

Daniel Scherzer 10

Solution: Perspective aliasing

Insufficient resolution near the observerRedistribute shadow map samples

Page 11: Robust Shadow Maps for Large Environments

Daniel Scherzer 11

Solution: Perspective aliasing

Sufficient resolution near the observerRedistribute shadow map samples

still okay okay now

Page 12: Robust Shadow Maps for Large Environments

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

Page 13: Robust Shadow Maps for Large Environments

Daniel Scherzer 13

Solution: Projection aliasing

Receivers ~ perpendicular to shadow plane

Redistribution doesn‘t work

But!

Page 14: Robust Shadow Maps for Large Environments

Daniel Scherzer 14

Solution: Projection aliasing

Diffuse lighting: I = IL max( dot( L, N ), 0 )

~ perpendicular receivers have small I

Dark Hides artefacts!

LN

Page 15: Robust Shadow Maps for Large Environments

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

Page 16: Robust Shadow Maps for Large Environments

Daniel Scherzer 16

Solution: Projection aliasing

Screen-space blur of shadows

Hides artefacts

Shadows get softer

Page 17: Robust Shadow Maps for Large Environments

Daniel Scherzer 17

Problem: Self-(un)shadowing

Observers‘s distance > shadow depthIncorrect self-shadowing

Polygon

Biased polygon

Observer‘s distance < shadow depthSelf-shadowing eliminated

Page 18: Robust Shadow Maps for Large Environments

Daniel Scherzer 18

Solution: Self-(un)shadowing

How do we choose the bias?

Slope-scale biasing

Constant biasing

No biasing

Page 19: Robust Shadow Maps for Large Environments

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

Page 20: Robust Shadow Maps for Large Environments

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

Page 21: Robust Shadow Maps for Large Environments

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

Page 22: Robust Shadow Maps for Large Environments

Daniel Scherzer 22

Putting It All Together