Your SlideShare is downloading. ×
Viewing Projection
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Viewing Projection

2,690
views

Published on

Published in: Art & Photos, Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,690
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
84
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Viewing & Projection
  • 2. The 3D camera model
    • Camera has position and orientation in world space and looks into the scene.
    • Though we think of it as a camera or eye, we use a point, a couple vectors to give orientation, and an image plane between the camera and the visible scene.
  • 3. Viewing coordinates
    • We need a canonical coordinate system for view space:
      • viewing-coordinate system or view reference coordinate system
    • It’s time to pick a convention:
      • In the viewing coordinates, we’ll look down the positive z-axis (right-handed system).
    • There are a number of ways we could set up this coordinate system. The most intuitive is the “ look at ” system.
  • 4. The view reference point
    • We start with a view reference point – the camera position.
    • This is given in world space coordinates.
    • This point will become the origin of the view reference system.
  • 5. Look at point
    • The first step in orienting the camera is to define the look at vector , typically be giving a point in world space the camera is pointed towards.
    • This gives us the axis in world space we are looking down (which we want to map to the z axis in view space).
  • 6. View-up vector
    • This leaves us with a degree of freedom in camera orientation: the camera could be rotated any angle around the view axis
    • We define a view-up vector as the camera’s up vector.
  • 7. Projections
    • Once in view coordinates, we need to project coordinates onto the image plane (think film in the camera).
    • 2 types :
    • 1. Parallel projection
    • all lines of projection are parallel
    • We could drop the z coordinate:
    • 2. Perspective projection
    • the further away an object, the smaller its projection onto the image plane
    • We could divide by the z coordinate:
  • 8. Parallel projection
    • Orthographic (view direction parallel to projection direction)
  • 9. Parallel projection
    • Oblique (view direction not parallel to projection direction)
    • A shear is applied to x and y based on the value of z. The shear is defined by two angles:
    (x,y,z) (x,y) (x p ,y p )  
  • 10. Parallel projection
    • Problem 1: We’ve wiped out our z coordinate. Now how can we tell what’s closer to the camera?
    • Problem 2: Our coordinates are still based on the world coordinate system. This means our clipper has to be more general (more general = more slow)
    We want to 1) preserve some measure of depth, and 2) normalize the coordinate space Different systems pick slightly different normalizations left right top bottom near far
  • 11. Opengl for orthographic projection
    • glMatrixMode(GL_PROJECTION);
    • glLoadIdentity( );
    • glOrtho(Left, Right, Bottom, Top, Near, Far);
    • Example
    • glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
  • 12. Perspective projection
    • Features of perspective projection:
      • Foreshortening – objects appear smaller the further they are from the view reference point
      • Vanishing point – parallel lines intersect at infinity
  • 13. Perspective projection
  • 14. Perspective - a side view
    • The camera is at the view reference point looking in the negative z direction
    • The image plane is at the near plane
    (x,y,z) (x p ,y p ,z vp ) (0,0,z vrp )
  • 15. The view frustum left right top bottom far near
  • 16. Opengl for perspective projection
    • glMatrixMode(GL_PROJECTION); // make the projection matrix current
    • glLoadIdentity( );
    • gluPerspective(viewAngle, aspectRatio, N, F);
    • - N – distance from the eye to the near plane
    • - F - .. .. .. .. .. .. Far plane
    N F 