Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 This Chapter: we will learn about Requirements of a Computer Graphics Camera Visible Volumes Perspective vs Orthorgraphics Coordinate Systems Eye (Camera) Coordinate System 3D Normalized Device Coordinate System 3D to 2D Perspective Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 A Computer Graphics Camera Camera position Look at position Up direction Related terms: Image Plane Viewing Direction View Vector
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The Up Direction (Up Vector): Also referred to as: Twist Angle Cannot be parallel to viewing direction Does not need to be normalized Does not need to be perpendicular to viewing direction
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.1: Viewing Parameters All viewing parameters controlled by slider bars
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 z=slider: Twist angle: not perpendicular to View Vector! Tut 14.1: Controlling the Up Vector
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The Visible Volume Only geometries (primitives) inside the volume are visible All geometries (primitives) outside are ignored Primitives straddle the volume are Clipped!
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The Rectangular Visible Volume Volume defined by: Near Plane (n) Far Plane (f) Width (W) Height (H) For Orthographic Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.2: Rectangular Visible Volume Experiment with Rectangular Visible Volume
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.2: Orthographic Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The Viewing Frustum Volume Volume defined by: Near Plane (n) Far Plane (f) Fields of view (fov) For Orthographic Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Near Plane and Aspect Ratio Aspect Ratio Near Plane Height (n h ) Width (n w )
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.3: Viewing Frustum Experiment with Viewing Frustum
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.3: Perspective Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Orthographic vs Perspective Projection Orthographic Projection Parallel projection Preserve size Good for determining relative size Perspective Projection Projection along rays Closer objects appears larger Human vision! Only work with: Perspective Projection
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Near-to-Far Plane distance Fixed number of bits to resolve distance E.g.: 16-bits: Unique positions: If (f-n)=18: resolve distances larger than: If (f-n) = 10 6 : resolve distance larger than: Rule of Thumb: Minimize f and maximize n f-n – As tight as possible
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Tut 14.4: Near/Far Distance Two squares very close to each other: Set n/f values to see errors!!
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Coordinate Transformation Pipeline Recall: Transforms World Transform (M W ) Object Space (OC) To World Space (WC) View Transform (M V ) WC to Eye (Camera) Space (EC) Projection Transform (M P ) EC To NDC (Normalize Device)
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The M W : World Transform Transformation: From Object Space to World Space Identical to 2D! Refer to discussions: In Chapter 11: World Coordinate System Library Implementation: SceneNode’s Transform operator! DrawHelper: Matrix Stack Manipulations!
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The M V : View Transform Transformation From World to Eye Space Referred to as: Eye, or View, or Camera Transform Topics: Eye Coordinate Orthonormal Basis The Eye Coordinate (EC) Space Aligning EC and WC Orthonormal Basis The WC to EC Transform
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The EC Orthonormal Basis Viewing Parameters: Eye Position At Position Up Vector View Vector Side Vector Adjusted Up Vector:
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Example:
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The Eye Coordinate Space Origin: eye position Axes Directions View: -z Up: y Side: x Visible Volume Near: z=-n Far: z=-f
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Align EC and WC Orthonormal Basis
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 M V : M w2e WC To EC Transform
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Inverse Transform: M e2w Row-4 is: The Eye Position!!
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 The M P : Projection Transform Transform from EC to NDC Recall NDC Range: Transform: Squeeze the View Frustum into NDC Cube
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 View Frustum to NDC Cube
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 3D NDC to 2D Image (Near) Plane Resulting image on the near plane
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Re-Examine Tutorial 13.1 GrfxWindow::OnPaint()