chapter 15: working with the camera
DESCRIPTION
Chapter 15: Working with the Camera. This Chapter: we will learn about. One example of implementing Computer Graphics Camera Working with multiple Cameras Examples of interactive camera manipulation Select primitive in 3D scenes. Changes to Library: 2D to 3D. No changes: - PowerPoint PPT PresentationTRANSCRIPT
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 15: Working with the Camera
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
This Chapter: we will learn about One example of implementing
Computer Graphics Camera
Working with multiple Cameras
Examples of interactive camera manipulation
Select primitive in 3D scenes
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Changes to Library: 2D to 3D No changes:
Primitive: 2D primitives drawn in 3D SceneNode: continue to load MW Matrix Model: continue to be application main
class Changes:
WindowHandler When loading matrices!
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
WindowHandler: 2D vs 3D
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: Support for 3D New classes:
Camera PrimitiveAxisFrame:
Drawing x,y,z axis frame Modifications:
WindowHandler Support Camera Load View and Projection Matrices
XformInfo Support 3D rotation
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: New Classes and Changes
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: The Camera Class
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: WindowHandler changes
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: XformInfo Changes Xform Operator in 2D
Scale, Translate, Pivot: all 3D quantity Problem:
Rotation: θ rotates wrt to z-axis! Xform Operator in 3D (for now)
Rotation: (θx θy θz) Three rotations with respect to each axes
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: XformInfo details …
Xform Operator:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.1: Working with Lib14 Using: Camera and WindowHandler
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.1: WindowHandler details
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: D3D_WindowHandler
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.1: DrawHandler
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.1: Application CTutorialDlg
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.2: Working with 2 Cameras
CTutorialDlg class
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Interactive Manipulation of Camera
Parameters under explicit user control Camera position Look at position
Parameters implicitly controlled Up Vector: try to maintain sense of “up”
Parameters typically not controlled Near/Far planes (no real-world correspondence) FOV – zooming control via camera position
movement
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Notation and Terminology
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.3: Camera Manipulation with the Mouse
Left Mouse Button (LMB) Orbit
Middle (MMB) Pan
Right (RMB) Zoom
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
LMB: Tumble or Orbit the Camera
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Left/Right Orbiting Axis of rotation: The “Up” Direction
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Up/Down Orbiting Axis or rotation: Side Vector
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Orbit: Idea Orbit or Rotate
Need Matrix:
Camera Position:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Orbit: Alternatively
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Orbit: Implementation Rotate the World when compute
MV Instead of: Compute:
Compute and load:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: Orbit Support Camera: mouse movement to
radians
And … using in WindowHandler
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: Using camera orbit info
In WindowHandler:: ComputeViewMatrix
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
MMB: Pan or Track the camera
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Vertical Tracking: (Along UpVector)
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tracking: Implementation Horizontal/Vertical mouse movements
dx and dy Computer Movement vector:
Left/Right tracking: along side-vector Up/down tracking: along up-vector
Update both camera and at positions:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: Tracking Support Camera Class:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
RMB: Dolly or Zoom the Camera
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Zoom: Implementation Mouse movement: d Move camera eye position in the
viewing direction!
Watch out!
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Lib14: Mouse Zoom support Camera class
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Drawing the Camera Requires at least two Views!
View-A cannot draw the camera of View-A! Can only draw the camera for another
view! i.e., View-A draws camera of View-B
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Drawing camera: View Matrix Details
Recall: for “orbiting”, we computed and loaded MV with:
To properly draw camera-B, from view-A Include camera-B orbiting! Un-do view-A’s camera orbiting ( )
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Implementation: Load into the WORLD matrix
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
3D DC to WC Transformation
Must: DC NDC EC WC
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Transform: DC to NDC Assume Recall:
Or: In 3D:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
DC Points and NDC Ray
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
NDC Ray to EC Ray Transform
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
NDC EC
If:
In general: or: Given:
Then:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Reconstruct the ray in EC: Given: In general, NDC Point:
is a line in EC:
Or:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
EC to WC Transform: Given:
Choose convenient ze values ze= 0 and ze = 1
Use to compute WC positions:
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.4: Mouse Click to WC Shift-LMB to see the selection ray
Chapter 15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Tut 15.4: Device to WC Xform