Download presentation
Presentation is loading. Please wait.
Published byBlaze Ellis Modified over 9 years ago
1
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Chapter 15: Working with the Camera
2
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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
3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Changes to Library: 2D to 3D No changes: Primitive: 2D primitives drawn in 3D SceneNode: continue to load M W Matrix Model: continue to be application main class Changes: WindowHandler When loading matrices!
4
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 WindowHandler: 2D vs 3D
5
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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
6
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: New Classes and Changes
7
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: The Camera Class
8
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: WindowHandler changes
9
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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
10
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: XformInfo details … Xform Operator:
11
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.1: Working with Lib14 Using: Camera and WindowHandler
12
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.1: WindowHandler details
13
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: D3D_WindowHandler
14
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.1: DrawHandler
15
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.1: Application CTutorialDlg
16
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.2: Working with 2 Cameras CTutorialDlg class
17
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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
18
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Notation and Terminology
19
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.3: Camera Manipulation with the Mouse Left Mouse Button (LMB) Orbit Middle (MMB) Pan Right (RMB) Zoom
20
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 LMB: Tumble or Orbit the Camera
21
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Left/Right Orbiting Axis of rotation: The “Up” Direction
22
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Up/Down Orbiting Axis or rotation: Side Vector
23
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Orbit: Idea Orbit or Rotate Need Matrix: Camera Position:
24
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Orbit: Alternatively
25
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Orbit: Implementation Rotate the World when compute M V Instead of: Compute: Compute and load:
26
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: Orbit Support Camera: mouse movement to radians And … using in WindowHandler
27
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: Using camera orbit info In WindowHandler:: ComputeViewMatrix
28
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 MMB: Pan or Track the camera
29
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Vertical Tracking: (Along UpVector)
30
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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:
31
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: Tracking Support Camera Class:
32
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 RMB: Dolly or Zoom the Camera
33
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Zoom: Implementation Mouse movement: d Move camera eye position in the viewing direction! Watch out!
34
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Lib14: Mouse Zoom support Camera class
35
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 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
36
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Drawing camera: View Matrix Details Recall: for “orbiting”, we computed and loaded M V with: To properly draw camera-B, from view-A Include camera-B orbiting! Un-do view-A’s camera orbiting ( )
37
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Implementation: Load into the WORLD matrix
38
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 3D DC to WC Transformation Must: DC NDC EC WC
39
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Transform: DC to NDC Assume Recall: Or: In 3D:
40
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 DC Points and NDC Ray
41
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 NDC Ray to EC Ray Transform
42
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 NDC EC If: In general: or: Given: Then:
43
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Reconstruct the ray in EC: Given: In general, NDC Point: is a line in EC: Or:
44
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 EC to WC Transform: Given: Choose convenient z e values z e = 0 and z e = 1 Use to compute WC positions:
45
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.4: Mouse Click to WC Shift-LMB to see the selection ray
46
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Tut 15.4: Device to WC Xform
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.