view volumes canonical view volumes why canonical view
play

View Volumes Canonical View Volumes Why Canonical View Volumes? - PowerPoint PPT Presentation

View Volumes Canonical View Volumes Why Canonical View Volumes? University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 standardized viewing volume representation specifies field-of-view, used for clipping permits


  1. View Volumes Canonical View Volumes Why Canonical View Volumes? University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 • standardized viewing volume representation • specifies field-of-view, used for clipping • permits standardization • restricts domain of z stored for visibility test • clipping perspective orthographic Tamara Munzner • easier to determine if an arbitrary point is orthogonal enclosed in volume with canonical view orthographic view volume perspective view volume parallel volume vs. clipping to six arbitrary planes y=top y=top • rendering x=left x=left y x or y = +/- z x or y back Viewing 3 y x or y • projection and rasterization algorithms can be z plane x=right back 1 reused z VCS plane front front z=-near VCS x -z y=bottom z=-far z=-far -z plane -1 x plane y=bottom x=right z=-near http://www.ugrad.cs.ubc.ca/~cs314/Vjan2016 -1 2 3 4 Normalized Device Coordinates Normalized Device Coordinates Understanding Z Understanding Z • convention near, far always positive in GL calls left/right x =+/- 1, top/bottom y =+/- 1, near/far z =+/- 1 • z axis flip changes coord system handedness THREE.OrthographicCamera(left,right,bot,top,near,far); • viewing frustum mapped to specific mat4.frustum(left,right,bot,top,near,far, projectionMatrix ); • RHS before projection (eye/view coords) NDC parallelepiped Camera coordinates • LHS after projection (clip, norm device coords) • Normalized Device Coordinates (NDC) x x • same as clipping coords VCS perspective view volume orthographic view volume x=1 NDCS y=top • only objects inside the parallelepiped get right y=top y y=top (1,1,1) x=left x=left rendered Frustum x=left y -z y z z left y • which parallelepiped? (-1,-1,-1) z z x x= -1 x=right x=right • depends on rendering system z=1 z= -1 VCS x z=-near x z=-far VCS y=bottom z=-far z=-far x y=bottom y=bottom z=-near x=right z=-near z=-n z=-f 5 6 7 8 Understanding Z Orthographic Derivation Orthographic Derivation Orthographic Derivation • why near and far plane? • scale, translate, reflect for new coord sys • scale, translate, reflect for new coord sys • scale, translate, reflect for new coord sys y top y ' 1 y top y ' 1 1 a top b • near plane: = → = = → = = ⋅ + y ' a y b y ' a y b = ⋅ + = ⋅ + • avoid singularity (division by zero, or very y bot y ' 1 y bot y ' 1 1 a bot b = → = − = → = − − = ⋅ + small numbers) VCS VCS NDCS NDCS 2 • far plane: 1 top b b 1 a top , b 1 a bot = + = − ⋅ = − − ⋅ top bot − y=top y=top y y (1,1,1) (1,1,1) • store depth in fixed-point representation x=left x=left 1 a top 1 a bot − ⋅ = − − ⋅ 2 top ⋅ y y (integer), thus have to have fixed range of z z b 1 = − 1 ( 1 ) a bot ( a top ) top bot − − = − ⋅ − − ⋅ − (-1,-1,-1) (-1,-1,-1) z z values (0 … 1) x x x=right x=right ( top bot ) 2 top 2 a ( bot top ) − − ⋅ = − + b = • avoid/reduce numerical precision artifacts for x x z=-far z=-far top bot − 2 y=bottom y=bottom distant objects z=-near z=-near a = top bot − − top bot − b = top bot − 9 10 11 12 Orthographic Derivation Orthographic Derivation Orthographic Derivation Orthographic Derivation • scale, translate, reflect for new coord sys • scale, translate, reflect for new coord sys • scale, translate, reflect for new coord sys • scale, translate, reflect for new coord sys y top y ' 1 = → = y ' a y b = ⋅ + 2 right left 2 right left 2 right left + + + y bot y ' 1       = → = − 0 0 0 0 0 0 − − −       right left right left right left right left right left right left − − − − − − 2       VCS a 2 top bot 2 top bot 2 top bot =  +   +   +  0 0 0 0 0 0 − − − top bot −       top bot top bot top bot top bot top bot top bot y=top − − − − − − P ' P P ' P P ' P = = =       x=left top bot  2 far near   2 far near   2 far near  y + − + − + − + 0 0 0 0 0 0 b − − −       = − far near far near far near far near far near far near z − − − − − − top bot       x=right −       x 0 0 0 1 0 0 0 1 0 0 0 1       z=-far       y=bottom z=-near same idea for right/left, far/near 13 14 15 16

Recommend


More recommend