Unformatted text preview:

Projection & Interaction Projection & Interaction Lecture 8Comp 236Spring 2005 Algebra of projection Canonical viewing volume Trackball interface Transform Hierarchies Preview of Assignment #22/14/2005 Lecture 9 2ProjectionsA projection maps all 3-D coordinates onto a desired viewing plane. Thus, making our 3-D world into a 2-D image. This sort of mapping is not affine like all of the transforms we’ve discussed thus far. In fact, projection matrices do not transform points from our affine space back into the same space. They transform points into something different. Usually, we will use a projection matrix to reduce the dimensionally of our affine points. Thus, we should expect projection matrices to be less than full rank. Our lives are greatly simplified by the fact that viewing transformations transform the eye to the origin and the look-at direction (optical axis) to a specified coordinate axis. This reduces the range of projection matrices. 2/14/2005 Lecture 9 3Orthographic ProjectionHere is an example of an parallel projection of our scene. Notice that the parallel lines of the tiled floor remain parallel after orthographic projection.The simplest form of projection, is to simply project all points along lines parallel to the z-axis. This form of projection is called orthographic or parallel. It is the common form of projection used by drafts people for top, bottom, and side views. The advantage of parallel projection is that the you can make accurate measurements of image features in the two dimensions that remain. The disadvantage is that the images don’t appear natural (i.e. they lack perspective foreshortening). 2/14/2005 Lecture 9 4Orthographic ProjectionThe projection matrix for orthographic projection is very simpleThere are some problems with this simple form, however. To begin with the units of the transformed points are still the same as the model. This is great for drafting, but in our case we’d like to units that are model-independent. This will allow us to perform a wide range of operations using normalized coordinates.=′′′1zyx10000000001000011zyx2/14/2005 Lecture 9 5Normalized Device CoordinatesTherefore we will compose our projection with a set of scale and a translation that maps our coordinates in world units to normalized device coordinates.2/14/2005 Lecture 9 6Orthographic Projections to NDCHere is the mapping:Some sanity checks:=′′′−+−−−+−−−+−−1zyx10000000001zyxnearfar)nearfar(nearfar2bottomtop)bottomtop(bottomtop2leftright)leftright(leftright21xleftxleftrightleftrightleftrightleftrightleftrightleft2−=−=−=′⇒=−−−+−⋅1xrightxleftrightleftrightleftrightleftrightleftrightright2==−=′⇒=−−−+−⋅We also scale the z coordinate in exactly the same way (i.e. all z values between near and far are mapped from –1 to 1 respectively).Technically, this coordinate is not part of the projection. But, we will use this value of z for other purposes.2/14/2005 Lecture 9 7Orthographic Projection in OpenGLThis matrix is constructed by the following OpenGL call:void glOrtho(doubleleft, doubleright,doublebottom, doubletop, doublenear, doublefar );And the 2-D version (another GL utility function):void gluOrtho2D( doubleleft, GLdoubleright,doublebottom, GLdoubletop);Which is just a call to glOrtho( ) with near = -1 and far = 1;2/14/2005 Lecture 9 8Perspective ProjectionArtists (Donatello, Brunelleschi, Durer, and Da Vinci) during the renaissance discovered the importance of perspective for making images appear realistic. This outdates mathematicians by more than 300 years. Perspective causes objects nearer to the viewer to appear larger than the same object would appear farther away. Another for introducing homogenous coordinates to computer graphics was to accomplish perspective projections using linear operators.2/14/2005 Lecture 9 9Signs of PerspectiveNotice how lines known to be parallel in image space appear to converge to a single point when viewed in perspective. This is an important attribute of lines in projective spaces, they always intersect at a point. 2/14/2005 Lecture 9 10Perspective ProjectionThe simplest transform for perspective projection is:We then apply our rules for a projective spaces, to find our preferred point (the one with a fourth component of 1) by dividing each element of the vector by w. In this example projection matrix, w is simply the z component.=′′1zyx0100000000100001w0ywxw2/14/2005 Lecture 9 11Normalized PerspectiveAs in the orthographic case, perspective projection preserves the units of world-space. Once again, to simplify later operations we would like to specify a perspective projection where some specific range of world-space coordinates are mapped to a Normalized coordinate system. 2/14/2005 Lecture 9 12NDC Perspective MatrixThis can be accomplished with a clever composition of transforms with our projection matrix.The values of left, right, top, and bottom are specified at the near depth. Let’s try some sanity checks:=′′′−⋅⋅−−+−+−−⋅−+−−⋅1zyx0100000000wzwywxwnearfarnearfar2nearfarnearfarbottomtop)bottomtop(bottomtopnear2leftright)leftright(leftrightnear21nearxnearzleftxnearnearleftright)leftright(nearleftrightleftnear2−==−=′⇒==−−+−⋅⋅1nearxnearzrightxnearnearleftright)leftright(nearleftrightrightnear2==−=′⇒==−+−⋅⋅2/14/2005 Lecture 9 13NDC Perspective Matrix=′′′−⋅⋅−−+−+−−⋅−+−−⋅1zyx0100000000wzwywxwnearfarnearfar2nearfarnearfarbottomtop)bottomtop(bottomtopnear2leftright)leftright(leftrightnear21farfarzfarzfarnearfarnearfar2nearfarnearfarnearfar)nearfar(far==+=′⇒=−−−⋅⋅−−+1nearnearznearznearnearfarnearfar2nearfarnearfarnearfar)farnear(near−==+=′⇒=−−−⋅⋅−−+This can be accomplished with a clever composition of transforms with our projection matrix.The values of left, right,


View Full Document

UNC-Chapel Hill COMP 770 - Projection & Interaction

Download Projection & Interaction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Projection & Interaction 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 Projection & Interaction 2 2 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?