1 / 100

CSCE 441 Computer Graphics 3-D Viewing

CSCE 441 Computer Graphics 3-D Viewing. Jinxiang Chai. Outline. 3D Viewing Required readings: HB 10-1 to 10-10 Compile and run the codes in page 388 - opengl three-dimensional viewing program example. 1. Taking Pictures Using A Real Camera. Steps: - Identify interesting objects

sutherlandj
Télécharger la présentation

CSCE 441 Computer Graphics 3-D Viewing

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. CSCE 441 Computer Graphics3-D Viewing Jinxiang Chai

  2. Outline 3D Viewing Required readings: HB 10-1 to 10-10 Compile and run the codes in page 388 - opengl three-dimensional viewing program example 1

  3. Taking Pictures Using A Real Camera Steps: - Identify interesting objects - Rotate and translate the camera to a desired camera viewpoint - Adjust camera settings such as focal length - Choose desired resolution and aspect ratio, etc. - Take a snapshot

  4. Taking Pictures Using A Real Camera Steps: - Identify interesting objects - Rotate and translate the camera to a desired camera viewpoint - Adjust camera settings such as focal length - Choose desired resolution and aspect ratio, etc. - Take a snapshot Graphics does the same thing for rendering an image for 3D geometric objects

  5. Rendering Images Using a Virtual Camera

  6. 3D Geometry Pipeline Rotate and translate the camera Object space World space View space Focal length Aspect ratio & resolution Normalized projection space Screen/Image space 5

  7. Taking Steps Together C M Object space World space View space P V Normalized project space Image space 11

  8. OpenGL Codes 12

  9. OpenGL Codes 13

  10. OpenGL Codes 14

  11. 3D Geometry Pipeline Object space World space View space Normalized project space Image space

  12. 3D Geometry Pipeline Translate, scale &rotate Object space World space glTranslate*(tx,ty,tz)

  13. 3D Geometry Pipeline Translate, scale &rotate Object space World space glScale*(sx,sy,sz)

  14. 3D Geometry Pipeline Translate, scale &rotate Object space World space Rotate about r by the angle glRotate*

  15. 3D Geometry Pipeline Object space World space View space Normalized projection space Image space Screen space

  16. 3D Geometry Pipeline World space View space Now look at how we would compute the world->eye transformation

  17. 3D Geometry Pipeline Rotate&translate World space View space Now look at how we would compute the world->eye transformation

  18. Camera Coordinate

  19. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) 23

  20. Camera Coordinate Canonical coordinate system - usually right handed (looking down –z axis) - convenient for project and clipping

  21. Camera Coordinate Mapping from world to eye coordinates - eye position maps to origin - right vector maps to x axis - up vector maps to y axis - back vector maps to z axis

  22. Viewing Transformation We have the camera in world coordinates We want to model transformation T which takes object from world to camera

  23. Viewing Transformation We have the camera in world coordinates We want to model transformation T which takes object from world to camera Trick: find T-1 taking object from camera to world

  24. Viewing Transformation ? We have the camera in world coordinates We want to model transformation T which takes object from world to camera Trick: find T-1 taking object from camera to world

  25. Review: 3D Coordinate Trans. p Transform object description from to 30

  26. Review: 3D Coordinate Trans. Transform object description from camera to world

  27. Viewing Transformation Trick: find T-1 taking object from camera to world - eye position maps to origin - back vector maps to z axis - up vector maps to y axis - right vector maps to x axis

  28. Viewing Transformation H&B equation (10-4) Trick: find T-1 taking object from camera to world

  29. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz)

  30. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) How to determine ? Mapping from world to eye coordinates

  31. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) How to determine ? Mapping from world to eye coordinates

  32. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) Mapping from world to eye coordinates

  33. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) Mapping from world to eye coordinates

  34. Viewing Trans: gluLookAt gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz) H&B equation (10-1) Mapping from world to eye coordinates

  35. Viewing Trans: gluLookAt Test: gluLookAt( 4.0, 2.0, 1.0, 2.0, 4.0, -3.0, 0, 1.0, 0 ) - What’s the transformation matrix from the world space to the camera reference system?

  36. 3D Geometry Pipeline 3D-3D viewing transformation World space View space

  37. Projection General definition transform points in n-space to m-space (m<n) In computer graphics map 3D coordinates to 2D screen coordinates

  38. Projection How can we project 3d objects to 2d screen space? General definition transform points in n-space to m-space (m<n) In computer graphics map 3D coordinates to 2D screen coordinates

  39. Perspective Projection Maps points onto “view plane” along projectors emanating from “center of projection” (COP)

  40. Perspective Projection What’s relationship between 3D points and projected 2D points? Maps points onto “view plane” along projectors emanating from “center of projection” (COP) 48

  41. 3D->2D Consider the projection of a 3D point on the camera plane

  42. 3D->2D Consider the projection of a 3D point on the camera plane 50

  43. 3D->2D By similar triangles, we can compute how much the x and y coordinates are scaled Consider the projection of a 3D point on the camera plane

  44. 3D->2D By similar triangles, we can compute how much the x and y coordinates are scaled Consider the projection of a 3D point on the camera plane

  45. Homogeneous Coordinates Is this a linear transformation?

  46. Homogeneous Coordinates Is this a linear transformation? • no—division by z is nonlinear

  47. Homogeneous Coordinates Is this a linear transformation? • Trick: add one more coordinate: • no—division by z is nonlinear homogeneous image coordinates homogeneous scene coordinates

  48. Homogeneous Point Revisited If w=1, nothing happens Sometimes, we call this division step the “perspective divide” Remember how we said 2D/3D geometric transformations work with the last coordinate always set to one What happens if the coordinate is not one We divide all coordinates by w:

  49. The Perspective Matrix Now we can rewrite the perspective projection equation as matrix-vector multiplications

  50. The Perspective Matrix This becomes a linear transformation! Now we can rewrite the perspective projection equation as matrix-vector multiplications

More Related