Shadow and Shadow Maps 5 What kind of

  • Slides: 31
Download presentation
Shadow and Shadow Maps [5]

Shadow and Shadow Maps [5]

What kind of visual cues does shadow give? • Object without shadow seem floating

What kind of visual cues does shadow give? • Object without shadow seem floating above the scene • Shadow gives the depth information • Shadow gives the information of the relative position of lights and objects in the scene [1]

What kind of visual cues does shadow give? • Shadow increases scene realism •

What kind of visual cues does shadow give? • Shadow increases scene realism • Shadow makes the scene conceivable

Some Shadow Algorithms • Shodow Polygon (Blinn) • Basically project polygon vertices to a

Some Shadow Algorithms • Shodow Polygon (Blinn) • Basically project polygon vertices to a flat plane • Shadow Polygon Scanline (Appel; Bouknight, Kelly) • Shadow Volume (F. C. Crow) [1]

Some Shadow Algorithms • Shodow Polygon (Blinn) • Shadow Polygon Scanline (Appel; Bouknight, Kelly)

Some Shadow Algorithms • Shodow Polygon (Blinn) • Shadow Polygon Scanline (Appel; Bouknight, Kelly) • Figure out all the polygons involved in shadowing. • Pair each polygon that cast shadow with each polygon that it casts shadow upon • Process shadow at each scanline for those polygons • Shadow Volume (F. C. Crow)

Some Shadow Algorithms • Shodow Polygon (Blinn) • Shadow Polygon Scanline (Appel; Bouknight, Kelly)

Some Shadow Algorithms • Shodow Polygon (Blinn) • Shadow Polygon Scanline (Appel; Bouknight, Kelly) • Shadow Volume (F. C. Crow) • Create a volume polygon for the intersection of view frustum and semi-infinite shadow volume • Collision test for the shadow volume and polygons [2]

Shadow Algorithms • Pros: Precision Good for production / static scenes • Cons: Requires

Shadow Algorithms • Pros: Precision Good for production / static scenes • Cons: Requires non-trivial data structures Requires large amount of memory Lack hardware support Too slow for interactive rendering

Shadow Map (L. Williams 1978) • Render from the view point of the light

Shadow Map (L. Williams 1978) • Render from the view point of the light source. • Use the depth buffer as shadow map [5]

Shadow Map (L. Williams 1978) • Render from camera view point • Project to

Shadow Map (L. Williams 1978) • Render from camera view point • Project to light source and compare with shadow map • If the depth are the same, it’s not under shadow (1) • If the point is behind shadow map, it’s under shadow (2) 1 2 [5]

Shadow Map Aliasing It’s all because of undersampling [5]

Shadow Map Aliasing It’s all because of undersampling [5]

Shadow Map Aliasing • dsrs/ri becomes large perspective aliasing • cos /cos becomes large

Shadow Map Aliasing • dsrs/ri becomes large perspective aliasing • cos /cos becomes large projection aliasing [5]

Shadow Map Aliasing • dsrs/ri becomes large perspective aliasing • cos /cos becomes large

Shadow Map Aliasing • dsrs/ri becomes large perspective aliasing • cos /cos becomes large projection aliasing [5]

Shadow Map • Pros: Performance not constrained by number of polygons Shadow map =

Shadow Map • Pros: Performance not constrained by number of polygons Shadow map = z-buffer. Supported in today’s graphic cards due to its simplicity • Cons: Aliasing!

Adaptive Shadow Map (R. Fernando, S. Fernandez, K. Bala, D. P. Greenberg 2001) •

Adaptive Shadow Map (R. Fernando, S. Fernandez, K. Bala, D. P. Greenberg 2001) • Transform as usual • Analyze shadow map base on depth. Try to reduce dsrs/ri and cos /cos [4]

Adaptive Shadow Map • Refined shadow map by building an hierarchical refinement map [4]

Adaptive Shadow Map • Refined shadow map by building an hierarchical refinement map [4]

Adaptive Shadow Map • Pros: • Much better quality than uniform shadow map •

Adaptive Shadow Map • Pros: • Much better quality than uniform shadow map • No manual intervention involved • Uses mip-map feature on hardware • Cons: Still a software solution (analyzer, data structure etc) Interactive drawbacks – need to refine a lot of data during interaction

Perspective Shadow Map – The Idea (Marc Stamminger, Gorge Drettakis 2002) • Apply perspective

Perspective Shadow Map – The Idea (Marc Stamminger, Gorge Drettakis 2002) • Apply perspective transformation to the scene • View frustum is now a cube instead of a pyramided [5]

Perspective Shadow Map – The Idea • Now the size in this new scene

Perspective Shadow Map – The Idea • Now the size in this new scene is proportional to the final image • We take the shadow map of the new scene instead • The result is a shadow map with resolution same as the final image [5]

Uniform Shadow Map Shadow map has lower resolution than image plane [5] Perspective Shadow

Uniform Shadow Map Shadow map has lower resolution than image plane [5] Perspective Shadow Map Shadow map has exactly same resolution than image plane

Is it really that easy? • No! The light sources need perspective transformation too

Is it really that easy? • No! The light sources need perspective transformation too • No! All objects casting shadow into view frustum must be included – need an optimization plan for bounding box

Perspective Shadow Map – Light Sources • Light sources need to be relocated before

Perspective Shadow Map – Light Sources • Light sources need to be relocated before shadow map is taken • Directional light in world space becomes point lights in post perspective space on infinity plane [5]

Perspective Shadow Map – Light Sources • Point lights are still point lights but

Perspective Shadow Map – Light Sources • Point lights are still point lights but not on the infinity plane • Point lights on infinity plane in world space becomes directional light [5]

Perspective Shadow Map – Objects • What happens if a shadow in view frustum

Perspective Shadow Map – Objects • What happens if a shadow in view frustum is cast by an object outside of view frustum? • In post-perspective space, the objects that needs to cast shadow appear beyond infinity plane. • Transformed objects beyond infinity plane appears inverted [5]

Perspective Shadow Map – Objects • Need to include more than just view frustum

Perspective Shadow Map – Objects • Need to include more than just view frustum for perspective transformation • M is all rays from light source to view frustum boundary • The new world space to transform, H, is intersection of M, S(world space boundary) and light frustum Now we have a little more than just view frustum [5]

Perspective Shadow Map – Objects • What about the inverted trees beyond infinity plane?

Perspective Shadow Map – Objects • What about the inverted trees beyond infinity plane? • Move the camera back in post perspective space so everything looks upright • This solves the problem but we lose some resolution for taking a bigger picture [5]

Perspective Shadow Map • Pros: • Everything uniform shadow map does, this can do

Perspective Shadow Map • Pros: • Everything uniform shadow map does, this can do much better • Way faster than adaptive shadow map • Takes full advantage of hardware supported shadow map • Cons: • Transformations are not so trivial • Slight computational overhead • Occasional degradation when shadows are cast by objects behind camera (but always better than shadow map)

Perspective Shadow Map – Pictures [5]

Perspective Shadow Map – Pictures [5]

Perspective Shadow Map – Pictures [5]

Perspective Shadow Map – Pictures [5]

Perspective Shadow Map – Pictures cs 2. machineroom. org/ media/doom 3 -2. jpg

Perspective Shadow Map – Pictures cs 2. machineroom. org/ media/doom 3 -2. jpg

References 1. J. Teng. Institute of automation. Chinese Academy of Science liama. ia. ac.

References 1. J. Teng. Institute of automation. Chinese Academy of Science liama. ia. ac. cn/meeting/Archives/shadow. ppt 2002 2. F. C. Crow Shadow algorithms for computer graphics. ACM Press. 1977. 3. L. Williams. Casting curved shadows on curved surface. Computer Graphics SIGGRAPH 1978 4. R. Fernando, S. Fernndez, K. Bala, D. P. Greenberg. Adaptive shadow maps. SIGGRAPH 2001 5. M. Stamminger, G. Drettakis. Perspective shadow maps. SIGGRAPH 2002

http: //www-sop. inria. fr/reves/publications/data/2002/SD 02/psm_divx. avi. gz

http: //www-sop. inria. fr/reves/publications/data/2002/SD 02/psm_divx. avi. gz