definitions
play

Definitions View Space : coordinate system with the viewer looking - PowerPoint PPT Presentation

Perspective Projection 1 Dr. Mihail September 6, 2016 1 Some of the images in these slides are taken from Dr. Stephen Chenney graphics course at UW Madison http://research.cs.wisc.edu/graphics/Courses/559-s2002/ (Dr. Mihail) 3D graphics


  1. Perspective Projection 1 Dr. Mihail September 6, 2016 1 Some of the images in these slides are taken from Dr. Stephen Chenney graphics course at UW Madison http://research.cs.wisc.edu/graphics/Courses/559-s2002/ (Dr. Mihail) 3D graphics September 6, 2016 1 / 24

  2. Definitions View Space : coordinate system with the viewer looking down the -z axis, with +x to the right and +y up World-View Transformation : takes points in world space and converts them into points in view space Projection Transformation : takes points in view space and converts them into points in Canonical View Space Canonical View Space : coordinate system with the viewer looking along -z, +x to the right and +y up. Here everything inside the cube x:[-1, 1], y:[-1, 1], z:[-1, 1] using orthogonal projection. (Dr. Mihail) 3D graphics September 6, 2016 2 / 24

  3. Perspective Projection (Dr. Mihail) 3D graphics September 6, 2016 3 / 24

  4. One Point Perspective https://www.youtube.com/watch?v=qmSg_F4P5yU (Dr. Mihail) 3D graphics September 6, 2016 4 / 24

  5. Two Point Perspective https://www.youtube.com/watch?t=52&v=7ZYBWA-ifEs (Dr. Mihail) 3D graphics September 6, 2016 5 / 24

  6. Three Point Perspective https://www.youtube.com/watch?v=BfHRReALvVc (Dr. Mihail) 3D graphics September 6, 2016 6 / 24

  7. Simple Perspective Transformation (Dr. Mihail) 3D graphics September 6, 2016 7 / 24

  8. Simple Perspective Transformation By similar triangles (Dr. Mihail) 3D graphics September 6, 2016 8 / 24

  9. Simple Perspective Transformation Using homogeneous coordinates (Dr. Mihail) 3D graphics September 6, 2016 9 / 24

  10. Simple Perspective Transformation One can write a line in parametric form: x = x 0 + td x 0 is a point on a line, t is a scalar (distance along the line from x 0 ) and d is a direction (unit length) Different x 0 gives different parallel lines           x 1 0 0 0 x 0 1 0 0 0 x d x 0 + tx d   z 0 + tz d 0 1 0 0 0 1 0 0 y y 0 y d y 0 + ty d            =  + t  =            z 0 + tz d  z 0 0 1 0 z 0 0 0 1 0 z d        1 1 1 0 0 0 1 0 0 0 0 w f f  fx d  z d fy d Taking the limit as t → ∞ , we get   z d   f (Dr. Mihail) 3D graphics September 6, 2016 10 / 24

  11. Simple Perspective Transformation Problems This does not map points to a Canonical View Volume Insufficient for all applications (e.g., depth testing, because we throw away information) (Dr. Mihail) 3D graphics September 6, 2016 11 / 24

  12. Orthographic View Volume (Dr. Mihail) 3D graphics September 6, 2016 12 / 24

  13. Perspective View Volume (Dr. Mihail) 3D graphics September 6, 2016 13 / 24

  14. Perspective View Volume Near and far planes are parallel to the image plane z v = n , z v = f Other planes all pass through the center of projection Left and right planes intersect the image planes in vertical lines The top and bottom planes intersect the image plane in horizontal lines (Dr. Mihail) 3D graphics September 6, 2016 14 / 24

  15. Perspective View Volume (Dr. Mihail) 3D graphics September 6, 2016 15 / 24

  16. Perspective View Volume (Dr. Mihail) 3D graphics September 6, 2016 16 / 24

  17. Perspective View Volume Can convert from image height to FOV or viceversa. (Dr. Mihail) 3D graphics September 6, 2016 17 / 24

  18. Perspective View Volume Symmetry. (Dr. Mihail) 3D graphics September 6, 2016 18 / 24

  19. Transformation We need a matrix that transforms (Dr. Mihail) 3D graphics September 6, 2016 19 / 24

  20. Transformation We need a matrix that transforms (Dr. Mihail) 3D graphics September 6, 2016 20 / 24

  21. Transformation Convert the perspective case to orthographic so we can use the canonical view space in the existent pipeline The intersection of lines with the near clip plane should not change (Dr. Mihail) 3D graphics September 6, 2016 21 / 24

  22. General Perspective  1 0 0 0   0 0 0  n 0 1 0 0 0 n 0 0     M p =  ≡  n + f   n + f  0 0 − f 0 0 − nf    n n 1 0 0 0 0 0 1 0 n This matrix leaves points with z = n unchanged It maps depth properly We can multiply a homogeneous matrix by any number without changing the final point, so the two matrices have the same effect (Dr. Mihail) 3D graphics September 6, 2016 22 / 24

  23. MV.js perspective() 1 function perspective( fovy , aspect , near , far ) 2 { 3 var f = 1.0 / Math.tan( radians(fovy) / 2 ); 4 var d = far - near; 5 6 var result = mat4 (); 7 result [0][0] = f / aspect; 8 result [1][1] = f; 9 result [2][2] = -(near + far) / d; 10 result [2][3] = -2 * near * far / d; 11 result [3][2] = -1; 12 result [3][3] = 0.0; 13 14 return result; 15 } (Dr. Mihail) 3D graphics September 6, 2016 23 / 24

  24. MV.js perspective() 1 f = tan − 1 ( fovy 2 ) d = far − near The Matrix f  0 0 0  a 0 f 0 0   M p =  − n + f 2 nf  0 0   d d 0 0 − 1 0 (Dr. Mihail) 3D graphics September 6, 2016 24 / 24

Recommend


More recommend