1 / 11

CSC 480 Computer Graphics K. Kirby Spring 2006

CSC 480 Computer Graphics K. Kirby Spring 2006. FRUST-RATION Viewing and projection. NKU CSC 480 Kirby. x. z. y. Setting up the Camera/Eye. frustum. upVector. eyePoint. fovy. targetPoint. zNear. zFar. glMatrixMode ( GL_PROJECTION) ; glLoadIdentity () ;

margot
Download Presentation

CSC 480 Computer Graphics K. Kirby Spring 2006

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 480 Computer Graphics K. Kirby Spring 2006 FRUST-RATION Viewing and projection. NKU CSC 480 Kirby

  2. x z y Setting up the Camera/Eye frustum upVector eyePoint fovy targetPoint zNear zFar glMatrixMode( GL_PROJECTION) ; glLoadIdentity() ; gluPerspective(fovy, aspect, zNear, zFar) ; gluLookAt( eyePoint, targetPoint, upVector ) ; NKU CSC 480 Kirby

  3. x y z 1 x y z 0 A Euclidean point (x,y,z) is represented by all nonzero multiplesof the column vector A point at infinity in the direction from the origin to (x,y,z) is represented by all nonzero multiples of the column vector This diagram shows the points represented by e1, e2, e3, e4. Homogenous Coordinates for Projective Geometry NKU CSC 480 Kirby

  4. 0 0 0 0 x y z w If v and w are two 4D column vectors, write v ~ w if v = kw, that is, if they represent the same point. kx ky kz kw k 0 ~ The column vector does not represent any point. Homogenous Coordinates for Projective Geometry, continued NKU CSC 480 Kirby

  5. x y z w The End of the (Pipe)Line x/w y/w 0 1 x/w y/w z/w 1 perspective division projection (x/w, y/w) ~ vertices after multiplication by Modelview and Projection matrices for w  0 x z y canonical view volume (clip coordinates) ALWAYS [-1,1]3 NKU CSC 480 Kirby

  6. Perspective Projection "screen" ~ 1500 NKU CSC 480 Kirby

  7. x y 0 1 x y z 1 (x,y,0) (x,y,0) P Find a matrix P such that ~ Perspective Projection y (x,y,z) x z z=d (x,y,z) "screen" NKU CSC 480 Kirby

  8. P depth P' P'' Projection Matrix Clip Coordinates [-1,1]3 Eye Coordinates projection matrix stack glOrtho glFrustum NKU CSC 480 Kirby

  9. depth ymin, ymax xmin, xmax must be positive Perspective Projection Matrices -(n+w)/d 0 0 0 0 -(n+w)/d 0 0 0 0 -(2n+w)/w 2n(n+w)/w 0 0 -1 0 P= y +1 +d z -d -1 -1 +1 w n glFrustum( -d, d, -d, d, n, n+w ) ; glFrustum( left, right, bottom, top, near, far ) ; NKU CSC 480 Kirby

  10. depth ymin, ymax xmin, xmax Orthographic Projection Matrices 1/d 0 0 0 0 1/d 0 0 0 0 -2/w -(2n+w)/w 0 0 0 1 P= y negative sign, since depth and z are conventionally opposite +d +1 z -1 -d -1 +1 n w glOrtho( -d, d, -d, d, n, n+w ) ; glOrtho( left, right, bottom, top, near, far ) ; NKU CSC 480 Kirby

  11. depth +1 -1 -1 +1 xmin, xmax ymin, ymax Orthographic Projection Matrices: Example 1 0 0 0 0 1 0 0 0 0 -1 0 0 0 0 1 P= y +1 z w=2 n= -1 -1 glOrtho( -1, 1, -1, 1, -1, 1 ) ; glOrtho( left, right, bottom, top, near, far ) ; NKU CSC 480 Kirby

More Related