Title: Shadow and Shadow Maps
1Shadow and Shadow Maps
5
2What 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
3What kind of visual cues does shadow give?
- Shadow increases scene realism
- Shadow makes the scene conceivable
4Some 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
5Some 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)
6Some 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
7Shadow 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
8- Shadow Map (L. Williams 1978)
- Render from the view point of the light source.
- Use the depth buffer as shadow map
-
5
9- 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, its not under shadow
(1) - If the point is behind shadow map, its under
shadow (2) -
1
2
5
10- Shadow Map Aliasing
- Its all because of undersampling
5
11- Shadow Map Aliasing
- dsrs/ri becomes large ? perspective aliasing
- cos?/cos? becomes large ? projection aliasing
5
12- Shadow Map Aliasing
- dsrs/ri becomes large ? perspective aliasing
- cos?/cos? becomes large ? projection aliasing
5
13Shadow Map
- Pros
- Performance not constrained by number of polygons
- Shadow map z-buffer.
- Supported in todays graphic cards due to its
simplicity - Cons
- Aliasing!
14Adaptive 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
15Adaptive Shadow Map
- Refined shadow map by building an hierarchical
refinement map
4
16Adaptive 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
17Perspective 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
18Perspective 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
19Uniform Shadow Map Shadow map has lower
resolution than image plane
5
Perspective Shadow Map Shadow map has exactly
same resolution than image plane
20Is 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
21Perspective 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
22Perspective 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
23Perspective 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
24Perspective 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
25Perspective 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
26Perspective 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)
27Perspective Shadow Map Pictures
5
28Perspective Shadow Map Pictures
5
29Perspective Shadow Map Pictures
cs2.machineroom.org/ media/doom3-2.jpg
30References
- J. Teng. Institute of automation. Chinese Academy
of Science liama.ia.ac.cn/meeting/Archives/shadow.
ppt 2002 - F.C. Crow Shadow algorithms for computer
graphics. ACM Press. 1977. - L. Williams. Casting curved shadows on curved
surface. Computer Graphics SIGGRAPH 1978 - R. Fernando, S. Fernndez, K. Bala, D.P.
Greenberg. Adaptive shadow maps. SIGGRAPH 2001 - M. Stamminger, G. Drettakis. Perspective shadow
maps. SIGGRAPH 2002
31http//www-sop.inria.fr/reves/publications/data/20
02/SD02/psm_divx.avi.gz