1 / 46

Chapter 15: Working with the Camera

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:

quant
Download Presentation

Chapter 15: Working with 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. Chapter 15: Working with the Camera Chapter 15

  2. 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

  3. 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

  4. WindowHandler: 2D vs 3D Chapter 15

  5. 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

  6. Lib14: New Classes and Changes Chapter 15

  7. Lib14: The Camera Class Chapter 15

  8. Lib14: WindowHandler changes Chapter 15

  9. 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

  10. Lib14: XformInfo details … Xform Operator: Chapter 15

  11. Tut 15.1: Working with Lib14 • Using: Camera and WindowHandler Chapter 15

  12. Tut 15.1: WindowHandler details Chapter 15

  13. Lib14: D3D_WindowHandler Chapter 15

  14. Tut 15.1: DrawHandler Chapter 15

  15. Tut 15.1: Application CTutorialDlg Chapter 15

  16. Tut 15.2: Working with 2 Cameras • CTutorialDlg class Chapter 15

  17. 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

  18. Notation and Terminology Chapter 15

  19. Tut 15.3: Camera Manipulation with the Mouse • Left Mouse Button (LMB) • Orbit • Middle (MMB) • Pan • Right (RMB) • Zoom Chapter 15

  20. LMB: Tumble or Orbit the Camera Chapter 15

  21. Left/Right Orbiting • Axis of rotation: The “Up” Direction Chapter 15

  22. Up/Down Orbiting • Axis or rotation: Side Vector Chapter 15

  23. Orbit: Idea • Orbit or Rotate • Need Matrix: • Camera Position: Chapter 15

  24. Orbit: Alternatively Chapter 15

  25. Orbit: Implementation • Rotate the World when compute MV • Instead of: • Compute: • Compute and load: Chapter 15

  26. Lib14: Orbit Support • Camera: mouse movement to radians • And … using in WindowHandler Chapter 15

  27. Lib14: Using camera orbit info • In WindowHandler:: ComputeViewMatrix Chapter 15

  28. MMB: Pan or Track the camera Chapter 15

  29. Vertical Tracking: (Along UpVector) Chapter 15

  30. 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

  31. Lib14: Tracking Support • Camera Class: Chapter 15

  32. RMB: Dolly or Zoom the Camera Chapter 15

  33. Zoom: Implementation • Mouse movement: d • Move camera eye position in the viewing direction! • Watch out! Chapter 15

  34. Lib14: Mouse Zoom support • Camera class Chapter 15

  35. 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

  36. 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

  37. Implementation: • Load into the WORLD matrix Chapter 15

  38. 3D DC to WC Transformation • Must: DC NDC  EC  WC Chapter 15

  39. Transform: DC to NDC • Assume • Recall: • Or: • In 3D: Chapter 15

  40. DC Points and NDC Ray Chapter 15

  41. NDC Ray to EC Ray Transform Chapter 15

  42. NDC  EC • If: • In general: or: • Given: • Then: Chapter 15

  43. Reconstruct the ray in EC: • Given: • In general, NDC Point: • is a line in EC: • Or: Chapter 15

  44. EC to WC Transform: • Given: • Choose convenient ze values • ze= 0 and ze = 1 • Use to compute WC positions: Chapter 15

  45. Tut 15.4: Mouse Click to WC • Shift-LMB to see the selection ray Chapter 15

  46. Tut 15.4: Device to WC Xform Chapter 15

More Related