CSCE 441 Computer Graphics 3-D Viewing - PowerPoint PPT Presentation

csce 441 computer graphics 3 d viewing n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CSCE 441 Computer Graphics 3-D Viewing PowerPoint Presentation
Download Presentation
CSCE 441 Computer Graphics 3-D Viewing

play fullscreen
1 / 97
CSCE 441 Computer Graphics 3-D Viewing
195 Views
Download Presentation
ayanna
Download Presentation

CSCE 441 Computer Graphics 3-D Viewing

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CSCE 441 Computer Graphics3-D Viewing Dr. Jinxiang Chai

  2. Outline 3D Viewing Required readings: HB 7-1 to 7-10 Compile and run the codes in page 388 1

  3. Taking Pictures Using A Real Camera Steps: - Identify interesting objects - Rotate and translate the camera to a desire 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 desire 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. 3D Geometry Pipeline Rotate and translate the camera Object space World space View space Focal length Aspect ratio & resolution Normalized projection space Image space 4

  6. 3D Geometry Pipeline Model space (Object space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations...

  7. 3D Geometry Pipeline World space (Object space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations...

  8. 3D Geometry Pipeline Eye space (View space) Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations...

  9. 3D Geometry Pipeline Normalized projection space Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations...

  10. 3D Geometry Pipeline Image space, window space, raster space, screen space, device space Before being turned into pixels by graphics hardware, a piece of geometry goes through a number of transformations...

  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 project 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. Camera Coordinate Canonical coordinate system - usually right handed (looking down –z axis) - convenient for project and clipping

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

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

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

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

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

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

  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 (7-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) 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) H&B equation (7-1) Mapping from world to eye coordinates

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

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

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

  37. How Do We See the World? Let’s design a camera: idea 1: put a piece of film in front of camera Do we get a reasonable picture?

  38. Pin-hole Camera • Add a barrier to block off most of the rays • This reduces blurring • The opening known as the aperture • How does this transform the image?

  39. Camera Obscura • The first camera • Known to Aristotle • Depth of the room is the focal length • Pencil of rays – all rays through a point

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

  41. 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) 40

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

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

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

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

  46. Homogeneous Coordinates Is this a linear transformation?

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

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

  49. 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:

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