210 likes | 238 Views
Shadows & occlusion. Shadow - occlusion duality Floor shadows Shadow buffer Soft shadows From point visibility Convex occluders Occluder fusion Cell-to-cell visibility. Lecture Objectives. Why study visibility and shadows? Define terminology Hidden, detected, guarded, clear
E N D
Shadows & occlusion • Shadow - occlusion duality • Floor shadows • Shadow buffer • Soft shadows • From point visibility • Convex occluders • Occluder fusion • Cell-to-cell visibility
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
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
4x4 matrix formulation (review) S(u,v,w) T(u,v,w) R(U,V,W) RZ(a) = M•P
Rotation matrix • ||U||=||V||=1 • U•V = 0 • W=UV • R = { U V W }, 3x3 matrix • R’ = R, inverse = transpose • Rotation to map Z to W • U:=YW or XW • U:=U/||U|| • V:=WxU • RZtoW={ U V W } • Rotation to map W to Z axis • RZtoW inverse R R’
Floor shadow • Compute the shadow S of point P on the floor (z=0) with light coming in direction L P L S = P + (Pz/Lz) L Write the shadow projection as a 4x4 matrix S
Floor shadows • Depth cue, realism, light position • Draw object twice • Second time: projected on the ground • Does not support self-shadows P L S = P + (Pz/Lz) L Durand&Cutler, MIT
Aliasing Shadow-castikng fragments must be in light frustum E 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 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
point source area source umbra penumbra umbra Soft shadows (area light sources) • Polygonal area light source Polygons cast curved shadows Assarsson et al.
point source area source umbra penumbra umbra Hard vs. soft shadows
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)
Soft Shadow volumes • Using graphics hardware Ulf Assarsson1, Michael Dougherty2, Michael Mounier2, and Tomas Akenine-Möller1 1Department of Computer Engineering Chalmers University of Technology 2Xbox Advanced Technology Group,Microsoft
Shadow Volume • A wedge for each “silhouette” edge
Results • www.ce.chalmers.se/staff/tomasm/soft/
Texture Map • Glue a picture on a surface • Associate with each vertex P the (u,v) coordinate of the corresponding pixel in the image Express P in the camera coordinate system P P’ Use the perspective to get P’ v C u Camera parameters for the picture E
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
Shadow map • From Durand & Cutler