DOC PREVIEW
Berkeley COMPSCI 184 - Lecture 8: Projection

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 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 40 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 40 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 40 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 40 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 40 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 40 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 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS-184: Computer GraphicsLecture #8: ProjectionProf. James O’BrienUniversity of California, BerkeleyV2009-F-08-1.02Today•Windowing and Viewing Transformations•Windows and viewports•Orthographic projection•Perspective projection3Screen Space•Monitor has some number of pixels•e.g. 1024 x 768•Some sub-region used for given program•You call it a window•Let’s call it a viewport instead[0, 0][1024, 768][60, 350][690, 705][0, 0][1024, 768]4Screen Space•May not really be a “screen”•Image file•Printer•Other•Little pixel details•Sometimes odd•Upside down•HexagonalFrom Shirley textbook.5Screen Space•Viewport is somewhere on screen•You probably don’t care where•Window System likely manages this detail•Sometimes you care exactly where•Viewport has a size in pixels•Sometimes you care (images, text, etc.)•Sometimes you don’t (using high-level library)Screen Space6Integer Pixel Addressesi=3j=5 10 × 10 Image Resolution-0.5,-0.5nx-0.5,ny-0.5Screen Space7Float Pixel Coordinatesu= 0.35 = (i + 0.5)/nx 0,01,1v= 0.55 = (j + 0.5)/ny 8Canonical View Space•Canonical view region•2D: [-1,-1] to [+1,+1]From Shirley textbook.-1,-1+1,+1x=0.0, y=0.09Canonical View Space•Canonical view region•2D: [-1,-1] to [+1,+1]xyy(1,1)(-1,-1)x(nx-0.5, -0.5)(-0.5, ny-0.5)xy(1,-1)(-1,1)(nx/2,-ny/2)(-nx/2,ny/2)yxreflect-ytranslatescaleFrom Shirley textbook.(Image coordinates are up-side-down.)24x0y0135=264nx20nx120ny2ny1200 137524xy135ijRemove minus for right-side-up10Canonical View Space•Canonical view region•2D: [-1,-1] to [+1,+1]•Define arbitrary window and define objects•Transform window to canonical region•Do other things (we’ll see clipping latter)•Transform canonical to screen space•Draw it.From Shirley textbook.11Canonical View SpaceWorld Coordinates Canonical Screen Space(Meters) (Pixels)Note distortion issues...12Projection•Process of going from 3D to 2D•Studies throughout history (e.g. painters)•Different types of projection•Linear•Orthographic•Perspective•NonlinearOrthographic is special case ofperspective...Many special cases in books just one of these two...}Perspective Projections13Ray Generation vs. ProjectionViewing in ray tracing•start with image point•compute ray that projects to that point•do this using geometryViewing by projection•start with 3D point•compute image point that it projects to•do this using transformsInverse processes•ray gen. computes the preimage of projection1415Linear Projection•Projection onto a planar surface•Projection directions either•Converge to a point•Are parallel (converge at infinity)16Linear Projection•A 2D viewOrthographicPerspective17Linear ProjectionOrthographicPerspective18Linear ProjectionOrthographicPerspective19OrthographicPerspectiveNote how different things can be seenParallel lines “meet” at infinityLinear Projection•A 2D view20Orthographic Projection•No foreshortening•Parallel lines stay parallel•Poor depth cuesOrthographic Projection2122Canonical View Space•Canonical view region•3D: [-1,-1,-1] to [+1,+1,+1]•Assume looking down -Z axis•Recall that “Z is in your face”[1,1,1][-1,-1,-1]-Z23Orthographic Projection•Convert arbitrary view volume to canonical[1,1,1][-1,-1,-1]-Z24Orthographic ProjectionView vectorUp vectorRight = view X up OriginCenternear,top,rightfar,bottom,left*Assume up is perpendicular to view.25Orthographic Projection•Step 1: translate center to origin26Orthographic Projection•Step 1: translate center to origin•Step 2: rotate view to -Z and up to +Y27Orthographic Projection•Step 1: translate center to origin•Step 2: rotate view to -Z and up to +Y•Step 3: center view volume28Orthographic Projection•Step 1: translate center to origin•Step 2: rotate view to -Z and up to +Y•Step 3: center view volume•Step 4: scale to canonical size29Orthographic Projection•Step 1: translate center to origin•Step 2: rotate view to -Z and up to +Y•Step 3: center view volume•Step 4: scale to canonical sizeM = S · T2· R · T1M = Mo· Mv30Perspective Projection•Foreshortening: further objects appear smaller•Some parallel line stay parallel, most don’t•Lines still look like lines•Z ordering preserved (where we care)31Perspective ProjectionPinhole a.k.a center of projectionImage from D. Forsyth32Perspective ProjectionForeshortening: distant objects appear smallerImage from D. Forsyth33Perspective Projection•Vanishing points•Depend on the scene•Not intrinsic to camera“One point perspective”34Perspective Projection•Vanishing points•Depend on the scene•Nor intrinsic to camera“Two point perspective”35Perspective Projection•Vanishing points•Depend on the scene•Not intrinsic to camera“Three point perspective”36Perspective ProjectionuvnView Frustum37Perspective ProjectionViewUpDistance to image planeiY-ZToptBottombNearnFarfCenter38Perspective Projection•Step 1: Translate center to originY-Z39Perspective Projection•Step 1: Translate center to origin•Step 2: Rotate view to -Z, up to +YY-Z40Perspective Projection•Step 1: Translate center to origin•Step 2: Rotate view to -Z, up to +Y•Step 3: Shear center-line to -Z axisY-Z41Perspective Projection•Step 1: Translate center to origin•Step 2: Rotate view to -Z, up to +Y•Step 3: Shear center-line to -Z axis•Step 4: Perspective-Z⎥⎥⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎢⎢⎣⎡−+01000000100001ififi42Perspective Projection•Step 4: Perspective•Points at z=-i stay at z=-i•Points at z=-f stay at z=-f•Points at z=0 goto z=±∞•Points at z=-∞ goto z=-(i+f)•x and y values divided by -z/i•Straight lines stay straight•Depth ordering preserved in [-i,-f ]•Movement along lines distorted-Z⎥⎥⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎢⎢⎣⎡−+01000000100001ififi43From Shirley textbook.view planeePerspective ProjectionWRONG!⎥⎥⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎢⎢⎣⎡−+01000000100001ififi44Perspective Projectionˆz“Eye” planeTopNear FarSome horizontal linesView vector45Perspective ProjectionˆzVisualizing division of x and y but not z46Perspective ProjectionˆzMotion in x,y47Perspective ProjectionˆzNote that points on near plane fixed48Perspective ProjectionˆzRecall that points on far plane willstay there...49Perspective ProjectionˆzWhen


View Full Document

Berkeley COMPSCI 184 - Lecture 8: Projection

Documents in this Course
Load more
Download Lecture 8: Projection
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 Lecture 8: Projection 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 Lecture 8: Projection 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?