Unformatted text preview:

Last Time Orthographic projection Viewing transformations Setting up a camera position and orientation 10 12 04 University of Wisconsin CS559 Spring 2004 Today Perspective viewing Homework 3 due 10 12 04 University of Wisconsin CS559 Spring 2004 Review View Space is a coordinate system with the viewer looking down the z axis with x to the right and y up The World View transformation takes points in world space and converts them into points in view space The Projection matrix or View Canonical matrix takes points in view space and converts them into points in Canonical View Space Canonical View Space is a coordinate system with the viewer looking along z x to the right y up and everything to be drawn inside the cube 1 1 x 1 1 x 1 1 using parallel projection 10 12 04 University of Wisconsin CS559 Spring 2004 OpenGL Camera The default OpenGL image plane has u aligned with the x axis v aligned with y and n aligned with z Means the default camera looks along the negative z axis Makes it easy to do 2D drawing no need for any view transformation glOrtho sets an orthographic view canonical matrix Modifies the GL PROJECTION matrix gluLookAt sets the world view matrix Takes an image center point a point along the viewing direction and an up vector Multiplies a world view matrix onto the current GL MODELVIEW matrix You could do this yourself using glMultMatrix with the matrix from the previous slides 10 12 04 University of Wisconsin CS559 Spring 2004 Typical View Spec Usage glMatrixMode GL PROJECTION glLoadIdentity glOrtho l r b t n f glMatrixMode GL MODELVIEW glLoadIdentity gluLookAt ex ey ez cx cy cx ux uy uz GLU functions such as gluLookAt are not part of the core OpenGL library They can be implemented with other core OpenGL commands For example gluLookAt uses glMultMatrix with the matrix from the previous slides They are not dependent on a particular graphics card 10 12 04 University of Wisconsin CS559 Spring 2004 Left vs Right Handed View Space You can define u as right v as up and n as toward the viewer a right handed system u v w Advantage Standard mathematical way of doing things You can also define u as right v as up and n as into the scene a left handed system v u w Advantage Bigger n values mean points are further away OpenGL is right handed Many older systems notably the Renderman standard developed by Pixar are left handed 10 12 04 University of Wisconsin CS559 Spring 2004 Perspective Projection Abstract camera model box with a small hole in it 10 12 04 Pinhole cameras work in practice University of Wisconsin CS559 Spring 2004 Distant Objects Are Smaller 10 12 04 University of Wisconsin CS559 Spring 2004 Parallel lines meet common to draw film plane in front of the focal point 10 12 04 University of Wisconsin CS559 Spring 2004 Vanishing points Each set of parallel lines direction meets at a different point The vanishing point for this direction Classic artistic perspective is 3point perspective Sets of parallel lines on the same plane lead to collinear vanishing points the horizon for that plane Good way to spot faked images 10 12 04 University of Wisconsin CS559 Spring 2004 Basic Perspective Projection We are going to temporarily ignore canonical view space and go straight from view to window Easier to understand and use for Project 2 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 the eye Define a focal distance d and put the image plane there note d is negative You can define d to control the size of the image 10 12 04 University of Wisconsin CS559 Spring 2004 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 10 12 04 University of Wisconsin CS559 Spring 2004 P xv yv zv zv Basic Case Similar triangles gives yv xs xv d zv y s yv d zv P xs ys d View Plane 10 12 04 University of Wisconsin CS559 Spring 2004 P xv yv zv zv Simple Perspective Transformation Using homogeneous coordinates we can write Our next big advantage to homogeneous coordinates xv xs y y v s zv d z v d 10 12 04 1 0 Ps 0 0 0 0 1 0 0 1 1 d 0 University of Wisconsin CS559 Spring 2004 0 0 Pv 0 0 Parallel Lines Meet Parallel lines are of the form x x 0 td Parametric form x0 is a point on the line t is a scalar distance along the line from x0 and d is the direction of the line unit vector Different x0 give different parallel lines Transform and go from homogeneous to regular x0 txd x 1 y 0 z 0 0 w 0 1 0 0 0 1 1 0 f 0 x0 1 0 y 0 0 t 0 z 0 0 0 1 0 fxd Limit as t is zd 10 12 04 fyd 0 1 0 0 0 1 1 0 zd f f 0 xd z tz d 0 0 y y ty d d f 0 0 z d z0 tzd 1 0 0 University of Wisconsin CS559 Spring 2004 General Perspective The basic equations we have seen give a flavor of what happens but they are insufficient for all applications They do not get us to a Canonical View Volume They make assumptions about the viewing conditions To get to a Canonical Volume we need a Perspective Volume 10 12 04 University of Wisconsin CS559 Spring 2004 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 10 12 04 University of Wisconsin CS559 Spring 2004 Clipping Planes Left Clip Plane Near Clip Plane xv n l View Volume r Far Clip Plane f zv Right Clip Plane 10 12 04 University of Wisconsin CS559 Spring 2004 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 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 10 12 04 University of Wisconsin CS559 Spring 2004 Field of View Assumes a symmetric …


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?