Shadows occlusion Shadow occlusion duality Floor shadows Shadow

  • Slides: 21
Download presentation
Shadows & occlusion § § § § Shadow - occlusion duality Floor shadows Shadow

Shadows & occlusion § § § § Shadow - occlusion duality Floor shadows Shadow buffer Soft shadows From point visibility Convex occluders Occluder fusion Cell-to-cell visibility Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 1

Lecture Objectives § Why study visibility and shadows? § Define terminology – Hidden, detected,

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 Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 2

Motivation § Visibility – Most objects in a scene are hidden from any given

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 Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 3

Shadows provide depth clues Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia

Shadows provide depth clues Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 4

4 x 4 matrix formulation (review) u 0 0 0 1 0 0 u

4 x 4 matrix formulation (review) u 0 0 0 1 0 0 u Ux Vx Wx 0 C -S 0 0 0 v 0 0 0 1 0 v Uy Vy Wy 0 S C 0 0 w 0 0 0 1 w Uz Vz Wz 0 0 0 1 0 0 0 1 S(u, v, w) 1 T(u, v, w) R(U, V, W) RZ(a) Ux Vx Wx u x Ux x + Vx y + W x z + u Uy Vy Wy v y Uy x + Vy y + W y z + v Uz Vz Wz w z 0 0 0 1 Uz x + Vz y + W z z + w = 1 1 M • P Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 5

Rotation matrix § ||U||=||V||=1 § U • V = 0 § W=U V §

Rotation matrix § ||U||=||V||=1 § U • V = 0 § W=U V § R = { U V W }, 3 x 3 matrix § R’ = R, inverse = transpose § Rotation to map Z to W – – U: =Y W or X W U: =U/||U|| V: =Wx. U RZto. W={ U V W } Ux Vx Wx Uy Vy Wy Uz Vz Wz R Ux Vx Wx 0 Uy Vy Wy 0 Uz Vz Wz 0 0 1 Ux Uy Uz Vx Vy Vz Wx Wy Wz inverse R’ § Rotation to map W to Z axis – RZto. W Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 6

Floor shadow § Compute the shadow S of point P on the floor (z=0)

Floor shadow § Compute the shadow S of point P on the floor (z=0) with light coming in direction L P L S = P + (P /L ) L z z Write the shadow projection as a 4 x 4 matrix Jarek Rossignac http: //www. gvu. gatech. edu/~jarek S 1 0 Lx/Lz 0 0 1 Ly/Lz 0 0 0 0 1 MAGIC Lab Georgia Tech, IIC, GVU, 2006 7

Floor shadows § Depth cue, realism, light position § Draw object twice – Second

Floor shadows § Depth cue, realism, light position § Draw object twice – Second time: projected on the ground § Does not support self-shadows 1 0 Lx/Lz 0 0 1 Ly/Lz 0 0 0 0 1 P L S = P + (Pz/Lz) L Jarek Rossignac http: //www. gvu. gatech. edu/~jarek Durand&Cutler, MIT MAGIC Lab Georgia Tech, IIC, GVU, 2006 8

Shadow map (supports self-shadows) § Pre-render from light : store z-buffer as shadow map

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 Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Aliasing Georgia Tech, IIC, GVU, 2006 9

Shadow volumes on GPU § Heidmann (IRIS Universe 1991), Everitt (n. Vidia 2002) –

Shadow volumes on GPU § Heidmann (IRIS Universe 1991), Everitt (n. Vidia 2002) – Shadow volume = triangles facing light + silhouette extrusions § Brabec-Seidel (EUROGRAPHICS 2003) – Add silhouette identification in hardware Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 10

Soft shadows (area light sources) § Polygonal area light source point source umbra Assarsson

Soft shadows (area light sources) § Polygonal area light source point source umbra Assarsson et al. Jarek Rossignac area source penumbra Polygons cast curved shadows http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 11

Hard vs. soft shadows point source umbra Jarek Rossignac http: //www. gvu. gatech. edu/~jarek

Hard vs. soft shadows point source umbra Jarek Rossignac http: //www. gvu. gatech. edu/~jarek area source penumbra MAGIC Lab umbra Georgia Tech, IIC, GVU, 2006 12

How can we compute (pen)umbras? § Difficult because they involve cells of 3 D

How can we compute (pen)umbras? § Difficult because they involve cells of 3 D space partition by planes and curved surfaces (even if the shape and light source is polygonal) Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 13

Polygons cast curved shadows! Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia

Polygons cast curved shadows! Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 14

Soft Shadow volumes § Using graphics hardware Ulf Assarsson 1, Michael Dougherty 2, Michael

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 Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 15

Shadow Volume § A wedge for each “silhouette” edge Jarek Rossignac http: //www. gvu.

Shadow Volume § A wedge for each “silhouette” edge Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 16

Rasterize the edges Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech,

Rasterize the edges Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 17

Results § www. ce. chalmers. se/staff/tomasm/soft/ Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC

Results § www. ce. chalmers. se/staff/tomasm/soft/ Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 18

Texture Map § Glue a picture on a surface § Associate with each vertex

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’ v C Use the perspective to get P’ u Camera parameters for the picture Jarek Rossignac http: //www. gvu. gatech. edu/~jarek E MAGIC Lab Georgia Tech, IIC, GVU, 2006 19

Shadow buffer § Pre-compute z-buffer for scene from the position of the light source

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 Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 20

Shadow map § From Durand & Cutler Jarek Rossignac http: //www. gvu. gatech. edu/~jarek

Shadow map § From Durand & Cutler Jarek Rossignac http: //www. gvu. gatech. edu/~jarek MAGIC Lab Georgia Tech, IIC, GVU, 2006 21