1 / 14

CS 4731: Computer Graphics Lecture 12: More 3D Viewing

CS 4731: Computer Graphics Lecture 12: More 3D Viewing. Emmanuel Agu. 3D viewing under the hood. Modeling Viewing Projection Transformation Transformation Transformation

yazid
Download Presentation

CS 4731: Computer Graphics Lecture 12: More 3D Viewing

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. CS 4731: Computer GraphicsLecture 12: More 3D Viewing Emmanuel Agu

  2. 3D viewing under the hood Modeling Viewing Projection Transformation Transformation Transformation Viewport Transformation Display

  3. 3D viewing under the hood • Topics of Interest: • Viewing transformation • Projection transformation

  4. Viewing Transformation • Transform the object from world to eye space • Construct eye coordinate frame • Construct matrix to perform coordinate transformation • Flexible Camera Control

  5. Viewing Transformation • Recall OpenGL way to set camera: • gluLookAt (Ex, Ey, Ez, cx, cy, cz, Up_x, Up_y, Up_z) • The view up vector is usually (0,1,0) • Remember to set the OpenGL matrix mode to GL_MODELVIEW first • Modelview matrix: • combination of modeling matrix M and Camera transforms V • gluLookAt fills V part of modelview matrix • What does gluLookAt do with parameters (eye, COI, up vector) you provide?

  6. center of interest (COI) eye Eye Coordinate Frame • Known: eye position, center of interest, view-up vector • To find out: new origin and three basis vectors Assumption: direction of view is orthogonal to view plane (plane that objects will be projected onto) o 90

  7. v n is pointing away from the world because we use left hand coordinate system N = eye – COI n = N / | N | u Center of interest (COI) eye n Remember u,v,n should be all unit vectors Eye Coordinate Frame • Origin: eye position (that was easy) • Three basis vectors: • one is the normal vector (n) of the viewing plane, • other two (u and v) span the viewing plane world origin (u,v,n should all be orthogonal)

  8. v V_up u COI eye n Eye Coordinate Frame • How about u and v? • We can get u first - • u is a vector that is perp • to the plane spanned by • N and view up vector (V_up) U = V_up x n u = U / | U |

  9. v V_up u COI eye n Eye Coordinate Frame • How about v? Knowing n and u, getting v is easy v = n x u v is already normalized

  10. v V_up u COI eye n Eye Coordinate Frame Eye space origin: (Eye.x , Eye.y, Eye.z) Basis vectors: n = (eye – COI) / | eye – COI| u = (V_up x n) / | V_up x n | v = n x u • Put it all together

  11. v u y n world x z World to Eye Transformation • Transformation matrix (Mw2e) ? P’ = Mw2e x P 1. Come up with the transformation sequence to move eye coordinate frame to the world 2. And then apply this sequence to the point P in a reverse order P

  12. v u y n world x z World to Eye Transformation • Rotate the eye frame to “align” it with the world frame • Translate (-ex, -ey, -ez) Rotation: ux uy uz 0 vx vy vz 0 nx ny nz 0 0 0 0 1 Translation: 1 0 0 -ex 0 1 0 -ey 0 0 1 -ez 0 0 0 1 (ex,ey,ez)

  13. v u y n (ex,ey,ez) world x z World to Eye Transformation • Transformation order: apply the transformation to the object in a reverse order - translation first, and then rotate Mw2e = ux uy ux 0 1 0 0 -ex vx vy vz 0 0 1 0 -ey nx ny nz 0 0 0 1 -ez 0 0 0 1 0 0 0 1

  14. v u y n world x z World to Eye Transformation • Head tilt: Rotate your head by d • Just rotate the object about the eye space z axis - d • Mw2e= cos(-d) -sin(-d) 0 0 ux uy ux 0 1 0 0 -ex sin(-d) cos(-d) 0 0 vx vy vz 0 0 1 0 -ey 0 0 1 0 nx ny nz 0 0 0 1 -ez 0 0 0 1 0 0 0 1 0 0 0 1 Why -d? When you rotate your head by d, it is like rotate the object by –d

More Related