1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadows & occlusion Shadow - occlusion duality Floor shadows Shadow buffer Soft shadows From point visibility Convex occluders Occluder fusion Cell-to-cell visibility
2 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture Objectives Why study visibility and shadows? Define terminology –Hidden, detected, guarded, clear –From-point and from-cell visibility –Shadow region, umbra, penumbra Understand principles, properties, proofs –Occlusion by a triangle –Testing against convex occluders –Apparent convexity and hoops –Occluder fusion –Umbra and penumbra of convex occluders Clarify relation between visibility and shadows Relate and motivate from-point and from-cell visibility Conservative & approximate from-point visibility algorithms Conservative & approximate from-cell visibility algorithms Relation to shadows, umbra, penumbra
3 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Motivation Visibility –Most objects in a scene are hidden from any given view point –Rendering them wastes GPU cycles –Need efficient techniques for rejecting what is obviously hidden Rejection tests can be exact, conservative (reject more), approximate Shadows –Objects in the shadow do not reflect direct illumination –Want to know which light sources illuminate an object –Need a quick test for being in the shadow Visibility and shadows are defined in terms of occluders –Surfaces or objects that may block the passage of light –When placed between the object and the viewer/light
4 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadows provide depth clues
5 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac 4x4 matrix formulation (review) u000 0v00 00w S(u,v,w) 100u 010v 001w 0001 T(u,v,w) UxUx VxVx WxWx 0 UyUy VyVy WyWy 0 UzUz VzVz WzWz R(U,V,W) C-S 00 S C R Z (a) UxUx VxVx WxWx u UyUy VyVy WyWy v UzUz VzVz WzWz w 0001 MP x y z 1 U x x + V x y + W x z + u U y x + V y y + W y z + v U z x + V z y + W z z + w 1 =
6 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Rotation matrix ||U||=||V||=1 UV = 0 W=U V R = { U V W }, 3x3 matrix R’ = R, inverse = transpose Rotation to map Z to W –U:=Y W or X W –U:=U/||U|| –V:=WxU –R ZtoW ={ U V W } Rotation to map W to Z axis – R ZtoW UxUx VxVx WxWx 0 UyUy VyVy WyWy 0 UzUz VzVz WzWz R UxUx VxVx WxWx UyUy VyVy WyWy UzUz VzVz WzWz UxUx UyUy UzUz VxVx VyVy VzVz WxWx WyWy WzWz R’ inverse
7 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Floor shadow Compute the shadow S of point P on the floor (z=0) with light coming in direction L S P S = P + (P z /L z ) L L Write the shadow projection as a 4x4 matrix 10 L x /L z 0 01 L y /L z
8 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Floor shadows Depth cue, realism, light position Draw object twice –Second time: projected on the ground Does not support self-shadows Durand&Cutler, MIT P L 10 L x /L z 0 01 L y /L z S = P + (P z /L z ) L
9 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadow map (supports self-shadows) Pre-render from light : store z-buffer as shadow map (texture) While rendering, check whether fragments are in shadow –Use GPU to perform the check (compare z to texture) Shadow-castikng fragments must be in light frustum E Aliasing Aliasing
10 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadow volumes on GPU Heidmann (IRIS Universe 1991), Everitt (nVidia 2002) –Shadow volume = triangles facing light + silhouette extrusions Brabec-Seidel (EUROGRAPHICS 2003) –Add silhouette identification in hardware
11 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Soft shadows (area light sources) Polygonal area light source point source umbra area source umbrapenumbra Assarsson et al. Polygons cast curved shadows
12 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Hard vs. soft shadows point source umbra area source umbrapenumbra
13 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac How can we compute (pen)umbras? Difficult because they involve cells of 3D space partition by planes and curved surfaces (even if the shape and light source is polygonal)
14 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Polygons cast curved shadows!
15 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Soft Shadow volumes Using graphics hardware Ulf Assarsson 1, Michael Dougherty 2, Michael Mounier 2, and Tomas Akenine-Möller 1 1 Department of Computer Engineering Chalmers University of Technology 2 Xbox Advanced Technology Group, Microsoft
16 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadow Volume A wedge for each “silhouette” edge
17 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Rasterize the edges
18 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Results
19 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Texture Map Glue a picture on a surface Associate with each vertex P the (u,v) coordinate of the corresponding pixel in the image u v E C Camera parameters for the picture P P’ Use the perspective to get P’ Express P in the camera coordinate system
20 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadow buffer Pre-compute z-buffer for scene from the position of the light source As you rasterize a point on a triangle, check whether it is visible from the light –Compute its P’ in the perspective-transformed space of the camera –Check whether Z[P’ X,P’ Y ] < P’ Z E
21 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadow map From Durand & Cutler