Presentation is loading. Please wait.

Presentation is loading. Please wait.

Projections and Hidden Surface Removal

Similar presentations


Presentation on theme: "Projections and Hidden Surface Removal"— Presentation transcript:

1 Projections and Hidden Surface Removal
Angel Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Objectives To discuss projection matrices to achieve desired perspective Discuss OpenGL API to achieve desired perspectives Explore hidden surface removal APIs in OpenGL Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

3 Projections and Normalization
The default projection in the eye (camera) frame is orthogonal For points within the default view volume Most graphics systems use view normalization All other views are converted to the default view by transformations that determine the projection matrix Allows use of the same pipeline for all views xp = x yp = y zp = 0 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

4 Homogeneous Coordinate Representation
default orthographic projection xp = x yp = y zp = 0 wp = 1 pp = Mp M = In practice, we can let M = I and set the z term to zero later Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

5 Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Camera Setups Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

6 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Simple Perspective Center of projection at the origin Projection plane z = d, d < 0 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

7 Perspective Equations
Consider top and side views xp = yp = zp = d Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

8 Perspective Transformation
Projection process Division by z Non-uniform foreshortening Farther from COP are smaller Closer to COP are larger Transform (x,y,z) to (xp, yp, zp) Irreversible All points along projector results to same point Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

9 Homogeneous Coordinates
If w != 0 Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

10 Homogeneous Coordinate Form
consider q = Mp where M = p =  q = Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

11 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Perspective Division However w  1, so we must divide by w to return from homogeneous coordinates This perspective division yields the desired perspective equations We will consider the corresponding clipping volume with the OpenGL functions xp = yp = zp = d Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

12 Perspective Division (cont)
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

13 Orthogonal Projection
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009

14 OpenGL Orthogonal Viewing
glOrtho(left,right,bottom,top,near,far) near and far measured from camera Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

15 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
OpenGL Perspective glFrustum(left,right,bottom,top,near,far) Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

16 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Using Field of View With glFrustum it is often difficult to get the desired view gluPerpective(fovy, aspect, near, far) often provides a better interface front plane aspect = w/h Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009


Download ppt "Projections and Hidden Surface Removal"

Similar presentations


Ads by Google