Presentation is loading. Please wait.

Presentation is loading. Please wait.

Viewing and Projection

Similar presentations


Presentation on theme: "Viewing and Projection"— Presentation transcript:

1 Viewing and Projection

2 Parallel Projection

3 Parallel Projections (known aliases): Orthographic or Isometric Projection

4 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Oblique Projection Arbitrary relationship between projectors and projection plane Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

5 Parallel Projections (known aliases): Oblique Projection
L

6 Perspective Projection
Projectors coverge at center of projection Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

7 Perspective Projection
foreshortening - the farther an object is from the camera , the smaller it appears in the final image

8 Perspective Projection
The geometry of the situation is that of similar triangles. View from above: What is x’ ? P (x, y, z) X Z View plane (0,0,0) x’ = ? d

9 Perspective Projection Top View
P=(xp,yp,zp) P’=(x’,y’,z’) CoP=(xc,yc,zc) xp x’ z’ zp

10 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
Simple Perspective Consider a simple perspective with the COP at the origin, the near clipping plane at z = -1, and a 90 degree field of view determined by the planes x = z, y = z Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

11 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
Perspective Matrices Simple projection matrix in homogeneous coordinates Note that this matrix is independent of the far clipping plane M = Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

12 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
Generalization N = after perspective division, the point (x, y, z, 1) goes to x’’ = x/z y’’ = y/z Z’’ = -(a+b/z) which projects orthogonally to the desired point regardless of a and b Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

13 What the Perspective Matrix means
Note: Normalized Device Coordinates are a LEFT-HANDED Coordinate system

14 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
Picking a and b If we pick a = b = the near plane is mapped to z = -1 the far plane is mapped to z =1 and the sides are mapped to x =  1, y =  1 Hence the new clipping volume is the default clipping volume Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

15 Normalization Transformation
distorted object projects correctly new clipping volume original object original clipping volume Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

16 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
OpenGL Perspective glFrustum allows for an unsymmetric viewing frustum (although gluPerspective does not) Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

17 OpenGL Perspective Matrix
The normalization in glFrustum requires an initial shear to form a right viewing pyramid, followed by a scaling to get the normalized perspective volume. Finally, the perspective matrix results in needing only a final orthogonal transformation P = NSH our previously defined perspective matrix shear and scale Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

18 glFrustum Matrix

19 Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009
Why do we do it this way? Normalization allows for a single pipeline for both perspective and orthogonal viewing We stay in four dimensional homogeneous coordinates as long as possible to retain three-dimensional information needed for hidden-surface removal and shading We simplify clipping Angel: Interactive Computer Graphics 5 © Addison-Wesley 2009

20 What the Perspective Matrix means
Note: Normalized Device Coordinates are a LEFT-HANDED Coordinate system

21 Graphics Pipeline So Far
Object Object Coordinates Transformation Object -> World World World Coordinates Projection Xform World -> Projection Camera Projection Coordinates Normalize Xform & Clipping Projection -> Normalized Viewport Normalized Coordinates Viewport Transform Normalized -> Device Screen Device Coordinates

22 What happens to an object...
Transformation Object -> World Object Object Coordinates World World Coordinates

23 What happens to an object...
Transformation - Modelview World -> Eye/Camera World World Coordinates Viewport Viewport Coordinates

24 What happens to an object...
Transformation - Projection (Includes Perspective Divide) Eye/Camera ->View Plane Viewport Viewport Coordinates Rasterization Scan Converting Triangles


Download ppt "Viewing and Projection"

Similar presentations


Ads by Google