DOC PREVIEW
UT CS 384G - Projections and Z-buffers

This preview shows page 1-2-16-17-18-34-35 out of 35 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don FussellProjections and Z-buffersUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 2ReadingRequired:Watt, Section 5.2.2 – 5.2.4, 6.3, 6.6 (esp. intro andsubsections 1, 4, and 8–10),Further reading:Foley, et al, Chapter 5.6 and Chapter 6David F. Rogers and J. Alan Adams, MathematicalElements for Computer Graphics, 2nd Ed., McGraw-Hill, New York, 1990, Chapter 2.I. E. Sutherland, R. F. Sproull, and R. A. Schumacker,A characterization of ten hidden surface algorithms,ACM Computing Surveys 6(1): 1-55, March 1974.University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 33D Geometry PipelineBefore being turned into pixels by graphics hardware, a piece ofgeometry goes through a number of transformations...University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 4Projections transform points in n-space to m-space, where m<n.In 3-D, we map points from 3-space to the projection plane (PP)along projectors emanating from the center of projection (COP):The center of projection is exactly the same as the pinhole in a pinholecamera.There are two basic types of projections:Perspective – distance from COP to PP finiteParallel – distance from COP to PP infiniteProjectionsUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 5Parallel projectionsFor parallel projections, we specify a direction ofprojection (DOP) instead of a COP.There are two types of parallel projections:Orthographic projection – DOP perpendicular to PPOblique projection – DOP not perpendicular to PPWe can write orthographic projection onto the z =0 planewith a simple matrix.But normally, we do not drop the z value right away. Whynot?! " x " y 1# $ % % % & ' ( ( ( =1 0 0 00 1 0 00 0 0 1# $ % % % & ' ( ( ( xyz1# $ % % % % & ' ( ( ( (University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 6Properties of parallel projectionProperties of parallel projection:Not realistic lookingGood for exact measurementsAre actually a kind of affine transformationParallel lines remain parallelAngles not (in general) preservedMost often used in CAD, architecturaldrawings, etc., where taking exact measurementis importantUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 7Derivation of perspective projectionConsider the projection of a point onto the projection plane:By similar triangles, we can compute how much the x and ycoordinates are scaled:[Note: Watt uses a left-handed coordinate system, and he looks downthe +z axis, so his PP is at +d.]! " x = #dzx" y = #dzy! " x x= #dz" y y= #dzUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 8Homogeneous coordinates revisitedRemember how we said that affine transformations workwith the last coordinate always set to one.What happens if the coordinate is not one?We divide all the coordinates by W:If W = 1, then nothing changes.Sometimes we call this division step the “perspectivedivide.”! X / WY /WZ /WW /W" # $ $ $ $ % & ' ' ' ' (xyz1" # $ $ $ $ % & ' ' ' 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 9Homogeneous coordinates and perspective projectionNow we can re-write the perspective projection as a matrix equation:After division by W, we get:Again, projection implies dropping the z coordinate to give a 2Dimage, but we usually keep it around a little while longer.! XYW" # $ $ $ % & ' ' ' =1 0 0 00 1 0 00 0 (1/ d 0" # $ $ $ % & ' ' ' xyz1" # $ $ $ $ % & ' ' ' ' =xy(z / d" # $ $ $ % & ' ' ' ! " x " y 1# $ % % % & ' ( ( ( =)xzd)yzd1# $ % % % % % % & ' ( ( ( ( ( (University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 10Projective normalizationAfter applying the perspective transformation anddividing by w, we are free to do a simple parallelprojection to get the 2D image.What does this imply about the shape of thingsafter the perspective transformation + divide?University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 11Vanishing pointsWhat happens to two parallel lines that are not parallel to theprojection plane?Think of train tracks receding into the horizon...The equation for a line is:After perspective transformation we get: ! l = p + tv =pxpypz1" # $ $ $ $ % & ' ' ' ' + tvxvyvz0" # $ $ $ $ % & ' ' ' ' ! XYW" # $ $ $ % & ' ' ' =px+ tvxpy+ tvy(( pz+ tvz) /d" # $ $ $ % & ' ' 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 12Vanishing points (cont'd)Dividing by W:Letting t go to infinity:We get a point that depends only on vWhat happens to the line ?Each set of parallel lines intersect at a vanishing point onthe PP.Q: How many vanishing points are there?! " x " y 1# $ % % % & ' ( ( ( =)px+ tvxpz+ tvzd)py+ tvypz+ tvzd)( pz+ tvz)/d)( pz+ tvz)/d# $ % % % % % % & ' ( ( ( ( ( ( ! "vxvz"vyvz1# $ % % % % % % & ' ( ( ( ( ( ( ! l = q + tvUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 13Properties of perspective projectionsThe perspective projection is an example of a projectivetransformation.Here are some properties of projective transformations:Lines map to linesParallel lines do not necessarily remain parallelRatios are not preservedOne of the advantages of perspective projection is that size variesinversely with distance – looks realistic.A disadvantage is that we can't judge distances as exactly as we canwith parallel projections.Q: Why did nature give us eyes that perform perspectiveprojections?Q: Do our eyes “see in 3D”?University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 14Z-bufferWe can use projections for hidden surface elimination.The Z-buffer' or depth buffer algorithm [Catmull, 1974] is probably thesimplest and most widely used of these techniques.Here is pseudocode for the Z-buffer hidden surface algorithm:for each pixel (i,j) doZ-buffer [i,j] ← FARFramebuffer[i,j] ← <background color>end forfor each polygon A dofor each pixel in A doCompute depth z and shade s of A at (i,j)if z > Z-buffer [i,j] thenZ-buffer [i,j] ← zFramebuffer[i,j] ← send ifend forend forUniversity of Texas at Austin CS384G - Computer


View Full Document

UT CS 384G - Projections and Z-buffers

Documents in this Course
Shading

Shading

27 pages

Shading

Shading

27 pages

Load more
Download Projections and Z-buffers
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 Projections and Z-buffers 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 Projections and Z-buffers 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?