1 / 19

The View Frustum and the Camera

The View Frustum and the Camera. Lecture 19 Fri, Oct 10, 2003. The View Frustum. The view frustum is in the shape of a truncated pyramid, with its vertex at the eye, or camera. The frustum is defined by six planes. left and right (x direction) top and bottom (y direction)

doli
Download Presentation

The View Frustum and the Camera

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. The View Frustum and the Camera Lecture 19 Fri, Oct 10, 2003

  2. The View Frustum • The view frustum is in the shape of a truncated pyramid, with its vertex at the eye, or camera. • The frustum is defined by six planes. • left and right (x direction) • top and bottom (y direction) • near and far (z direction)

  3. The View Frustum left right

  4. The View Frustum top bottom

  5. The View Frustum near far

  6. The Perspective Function • The view frustum is defined by the function gluPerspective(). • gluPerspective(viewAngle, aspectRatio, near, far). • Example: gluPerspective(45, 4./3., 0.1, 100.0);

  7. The Projection Matrix • The Perspective function creates the projection matrix, which is used to project the 3D scene onto a 2D plane. • We will discuss the projection matrix in more detail later.

  8. World Coordinates Object Coordinates Model Matrix View Matrix Projection Matrix Viewport Matrix Device Coordinates Window Coordinates Camera (Eye) Coordinates The Graphics Pipeline

  9. camera view frustum The Camera • The camera determines the position, direction, and orientation of the view frustum in world coordinates.

  10. The Camera • The function gluLookAt() positions the camera. • gluLookAt(eye.x, eye.y, eye.z, look.x, look.y, look.z, up.x, up.y, up.z). • The camera is positioned at “eye”. • The camera is pointed towards “look”. • The camera is oriented in the direction “up”.

  11. Fixed Camera • We may place the camera in a fixed position. • For example, place the camera at 5 on the z-axis, looking at the origin. gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

  12. Movable Camera • We may create a movable camera by making eye, look, and up variable. • Normally up is fixed at (0, 1, 0). • Often we fix look at (0, 0, 0). • We may vary eye in rectangular or spherical coordinates.

  13. Rectangular Coordinates • We may use the x, y, and z keys to vary the x, y, and z coordinates of the camera. • ‘X’, ‘x’: increment or decrement x. • ‘Y’, ‘y’: increment or decrement y. • ‘Z’, ‘z’: increment or decrement z.

  14. Spherical Coordinates • We call these distance, pitch, and yaw. • Pitch and yaw are angles. • The “roll” is normally fixed at 0 from the vertical. • Measure pitch in the vertical plane. • Measure yaw in the horizontal plane.

  15. Spherical Coordinates yaw

  16. Spherical Coordinates pitch

  17. Spherical Coordinates eye.x = dist  cos(pitch) sin(yaw). eye.y = dist  sin(pitch). eye.z = dist  cos(pitch)  cos(yaw).

  18. Spherical Coordinates • We may use the keyboard to vary the distance, pitch, and yaw coordinates of the camera. • ‘+’, ‘–’: increment or decrement distance. • , : increment or decrement pitch. • , : increment or decrement yaw.

  19. Example: Viewing the Cone • CameraMover.cpp • mesh.cpp • LookMover.cpp

More Related