Unformatted text preview:

Last Time Canonical view pipeline Local Coordinate Space World Coordinate Space Orthographic projection View Space 3D Screen Space Display Space Projection There was an error in the matrix for taking a simple orthographic volume and transforming it into the canonical view space The slides now online are correct In Shirley s chapter on Transformation note notation errors in the discussion of homogeneous coordinates 02 26 02 c 2002 University of Wisconsin CS 559 Today Perspective viewing Simple case Completely general case 02 26 02 c 2002 University of Wisconsin CS 559 Perspective Projection Abstract camera model box with a small hole in it 02 26 02 Pinhole cameras work in practice camera obscura etc c 2002 University of Wisconsin CS 559 Distant Objects Are Smaller 02 26 02 c 2002 University of Wisconsin CS 559 Parallel lines meet common to draw film plane in front of the focal point 02 26 02 c 2002 University of Wisconsin CS 559 Vanishing points Each set of parallel lines direction meets at a different point The vanishing point for this direction Classic artistic perspective is 3point persepctive Sets of parallel lines on the same plane lead to collinear vanishing points the horizon for that plane Good way to spot faked images 02 26 02 c 2002 University of Wisconsin CS 559 Basic Perspective Projection Assume you have transformed to view space with x to the right y up and z back toward the viewer Assume the origin of view space is at the center of projection Define a focal distance d and put the image plane there note d is negative This doesn t quite fit into our viewing model but we ll come back to that 02 26 02 c 2002 University of Wisconsin CS 559 Basic Perspective Projection If you know P xv yv zv and d what is P xs ys Where does a point in view space end up on the screen yv P xs ys d xv 02 26 02 c 2002 University of Wisconsin CS 559 P xv yv zv zv Basic Case Similar triangles gives yv xs xv d zv P xs ys d View Plane 02 26 02 c 2002 University of Wisconsin CS 559 y s yv d zv P xv yv zv zv Simple Perspective Transformation Using homogeneous coordinates we can write xv xs y y v s zv d z v d 02 26 02 1 0 Ps 0 0 0 0 1 0 0 0 1 1 d c 2002 University of Wisconsin CS 559 0 0 Pv 0 0 Perspective View Volume Recall the orthographic view volume defined by a near far left right top and bottom plane The perspective view volume is also defined by near far left right top and bottom planes the clip planes Near and far planes are parallel to the image plane zv n zv f Other planes all pass through the center of projection the origin of view space The left and right planes intersect the image plane in vertical lines The top and bottom planes intersect in horizontal lines 02 26 02 c 2002 University of Wisconsin CS 559 Clipping Planes Left Clip Plane Near Clip Plane xv n l View Volume r Far Clip Plane f zv Right Clip Plane 02 26 02 c 2002 University of Wisconsin CS 559 Where is the Image Plane Notice that it doesn t really matter where the image plane is located once you define the view volume You can move it forward and backward along the z axis and still get the same image only scaled But we need to know where it is to define the clipping planes Assume the left right top bottom planes are defined according to where they cut the near clip plane Or define the left right and top bottom clip planes by the field of view 02 26 02 c 2002 University of Wisconsin CS 559 Clipping Planes Left Clip Plane Near Clip Plane xv FOV View Volume Far Clip Plane f zv Right Clip Plane 02 26 02 c 2002 University of Wisconsin CS 559 OpenGL gluPerspective Field of view in the y direction vertical field of view Aspect ratio should match window aspect ratio Near and far clipping planes Defines a symmetric view volume glFrustum Give the near and far clip plane and places where the other clip planes cross the near plane Defines the general case Used for stereo viewing mostly 02 26 02 c 2002 University of Wisconsin CS 559 Perspective Projection Matrices We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volume This matrix will go in our pipeline just before the orthographic projection matrix r t n r t n l b n l b n 02 26 02 c 2002 University of Wisconsin CS 559 Mapping Lines We want to map all the lines through the center of projection to parallel lines Points on lines through the center of projection map to the same point on the image Points on parallel lines map orthographically to the same point on the image If we convert the perspective case to the orthographic case we can use all our existing methods The intersection points of lines with the near clip plane should not change The matrix that does this not surprisingly looks like the matrix for our simple perspective case 02 26 02 c 2002 University of Wisconsin CS 559 General Perspective 1 0 M P 0 0 0 0 0 n 1 0 0 0 0 n f n f 0 0 1n 0 0 0 0 n 0 0 n f 0 1 0 0 nf 0 This matrix leaves points with z n unchanged It is just like the simple projection matrix but it does some extra things to z to map the depth properly We can multiply a homogenous matrix by any number without changing the final point so the two matrices above have the same effect 02 26 02 c 2002 University of Wisconsin CS 559 Complete Perspective Projection After applying the perspective matrix we still have to map the orthographic view volume to the canonical view volume r l 2 0 0 r l r l n 0 0 0 2 t b 0 0 n 0 0 0 M view screen M O M P t b t b 0 0 n f nf 2 n f 0 0 0 0 1 0 n f n f 0 02 26 02 0 0 1 c 2002 University of Wisconsin CS 559 OpenGL Perspective Projection For OpenGL you give the distance to the near and far clipping planes The total perspective projection matrix resulting from a glFrustum call is M OpenGL 02 26 02 2n r l 0 0 0 0 2n t b 0 0 r l r l t b t b n f n f 1 0 2f n n f 0 c 2002 University of Wisconsin CS 559 0 Near Far and Depth Resolution It may seem sensible to specify a very near clipping plane and a very far clipping plane Sure to contain …


View Full Document

UW-Madison CS 559 - CS 559 Lecture Notes

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Loading Unlocking...
Login

Join to view CS 559 Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 559 Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?