1 / 30

SI23 Introduction to Computer Graphics

SI23 Introduction to Computer Graphics. Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping. viewing co-ords. Projection Transform’n. mod’g co-ords. world co-ords. Viewing Pipeline So Far. From the last lecture, we now should understand the viewing pipeline.

guy
Download Presentation

SI23 Introduction to Computer Graphics

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. SI23Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping

  2. viewing co-ords Projection Transform’n mod’g co-ords world co-ords Viewing Pipeline So Far • From the last lecture, we now should understand the viewing pipeline Viewing Transform’n Modelling Transform’n The next stage is the projection transformation….

  3. Perspective and Parallel Projection parallel perspective

  4. Puzzle from Earlier Lecture

  5. Ames Room

  6. Another Example

  7. yV zV camera camera direction xV Viewing Co-ordinate System • The viewing transformation has transformed objects into the viewing co-ordinate system, where the camera position is at the origin, looking along the negative z-direction

  8. dNP View Volume yV zV near plane far plane camera q xV dFP We determine the view volume by: - view angle, q - aspect ratio of viewplane - distances to near plane dNP and far plane dFP

  9. yV near plane zV camera dNP xV Projection We shall project on to the near plane. Remember this is at right angles to thezV direction, and has z-coordinate zNP = - dNP

  10. yV near plane zV camera Q dNP xV yV zNP zQ zV camera view plane Perspective Projection Calculation zNP looking down x-axis towards the origin

  11. Q yV zNP zQ zV camera view plane Perspective Projection Calculation P By similar triangles, yP / yQ = ( - zNP) / ( - zQ) and so yP = yQ * (- zNP) / ( - zQ) or yP = yQ * dNP / ( - zQ) Similarly for the x-coordinate of P: xP = xQ * dNP / ( - zQ)

  12. Using Matrices and Homogeneous Co-ordinates • We can express the perspective transformation in matrix form • Point Q in homogeneous coordinates is (xQ, yQ, zQ, 1) • We shall generate a point H in homogeneous co-ordinates (xH, yH, zH, wH), where wH is not 1 • But the point (xH/wH, yH/wH, zH/wH, 1) is the same as H in homogeneous space • This gives us the point P in 3D space, ie xP = xH/wH, sim’ly for yP

  13. xQ yQ zQ 1 xH yH zH wH 1 0 0 0 0 1 0 0 0 0 1 0 0 0 -1/dNP 0 Transformation Matrix for Perspective = Thus in Homogeneous co-ordinates: xH = xQ; yH = yQ; zH = zQ; wH = (-1/dNP)zQ In Cartesian co-ordinates: xP = xH / wH = xQ*dNP/(-zQ); yP similar; zP = -dNP = zNP

  14. OpenGL • Perspective projection achieved by: gluPerspective (angle_of_view, aspect_ratio, near, far) • aspect ratio is width/height • near and far are positive distances

  15. Vanishing Points • When a 3D object is projected onto a view plane using perspective, parallel lines in object NOT parallel to the view plane converge to a vanishing point vanishing point one-point perspective projection of cube view plane

  16. One- and Two-Point Perspective Drawing

  17. One-point Perspective This is: Trinity with the Virgin, St John and Donors, by Mastaccio in 1427 Said to be the first painting in perspective

  18. Two-point Perspective Edward Hopper Lighthouse at Two Lights -see www.postershop.com

  19. Orthographic parallel projection has view plane perpendicular to direction of projection Oblique parallel projection has view plane at an oblique angle to direction of projection Parallel Projection - Two types P1 P1 P2 P2 view plane view plane We shall only consider orthographic projection

  20. yV near plane zV dNP xV Parallel Projection Calculation looking down x-axis Q P yV zQ zNP zV view plane yP = yQ similarly xP= xQ

  21. Parallel Projection Calculation • So this is much easier than perspective! • xP = xQ • yP = yQ • zP = zNP • The transformation matrix is simply 1 0 0 0 0 1 0 0 0 0 zNP/zQ 0 0 0 0 1

  22. Clipping

  23. dNP View Frustum and Clipping yV zV near plane far plane camera q xV dFP The view volume is a frustum in viewing co-ordinates - we need to be able to clip objects outside of this region

  24. Clipping to View Frustum • It is quite easy to clip lines to the front and back planes (just clip in z).. • .. but it is difficult to clip to the sides because they are ‘sloping’ planes • Instead we carry out the projection first which converts the frustum to a rectangular parallelepiped (ie a cuboid) Retain the Z-coord

  25. Clipping for Parallel Projection • In the parallel projection case, the viewing volume is already a rectangular parallelepiped far plane view volume near plane zV

  26. Normalized Projection Co-ordinates • Final step before clipping is to normalize the co-ordinates of the rectangular parallelepiped to some standard shape • for example, in some systems, it is the cube with limits +1 and -1 in each direction • This is just a scale transformation • Clipping is then carried out against this standard shape

  27. view’g co-ords proj’n co-ords mod’g co-ords world co-ords normalized projection co-ordinates Viewing Pipeline So Far • Our pipeline now looks like: NORMALIZATIONTRANSFORMATION

  28. Viewport Transformation

  29. And finally... • The last step is to position the picture on the display surface • This is done by a viewport transformation where the normalized projection co-ordinates are transformed to display co-ordinates, ie pixels on the screen

  30. view’g co-ords proj’n co-ords mod’g co-ords world co-ords normalized projection co-ordinates Viewing Pipeline - The End • A final viewing pipeline is therefore: device co-ordinates DEVICETRANSFORMATION

More Related