DOC PREVIEW
Berkeley COMPSCI 184 - Lecture Notes

This preview shows page 1-2-3-4-5-6-39-40-41-42-43-79-80-81-82-83-84 out of 84 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 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 84 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 84 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, BerkeleyV2008-S-08-1.02TodayWindowing and Viewing TransformationsWindows and viewportsOrthographic projectionPerspective projection3Screen SpaceMonitor has some number of pixelse.g. 1024 x 768Some sub-region used for given programYou call it a windowLet’s call it a viewport instead[0, 0][1024, 768][60, 350][690, 705][0, 0][1024, 768]4Screen SpaceMay not really be a “screen”Image filePrinterOtherLittle pixel detailsSometimes oddUpside downHexagonalFrom Shirley textbook.5Screen SpaceViewport is somewhere on screenYou probably don’t care whereWindow System likely manages this detailSometimes you care exactly whereViewport has a size in pixelsSometimes 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)/ny8Canonical View SpaceCanonical view region2D: [-1,-1] to [+1,+1]From Shirley textbook.-1,-1+1,+1x=0.0, y=0.09Canonical View SpaceCanonical view region2D: [-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.)x!y!1=nx20nx−120ny2ny−120 0 1xy1−ijRemove minus for right-side-up9Canonical View SpaceCanonical view region2D: [-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.)x!y!1=nx20nx−120ny2ny−120 0 1xy1−Remove minus for right-side-up10Canonical View SpaceCanonical view region2D: [-1,-1] to [+1,+1]Define arbitrary window and define objectsTransform window to canonical regionDo other things (we’ll see clipping latter)Transform canonical to screen spaceDraw it.From Shirley textbook.11Canonical View SpaceWorld CoordinatesCanonicalScreen Space(Meters)(Pixels)Note distortion issues...12ProjectionProcess of going from 3D to 2DStudies throughout history (e.g. painters)Different types of projectionLinearOrthographicPerspectiveNonlinear12ProjectionProcess of going from 3D to 2DStudies throughout history (e.g. painters)Different types of projectionLinearOrthographicPerspectiveNonlinearMany special cases in books just one of these two...}12ProjectionProcess of going from 3D to 2DStudies throughout history (e.g. painters)Different types of projectionLinearOrthographicPerspectiveNonlinearOrthographic is special case ofperspective...Many special cases in books just one of these two...}Perspective Projections1314Linear ProjectionProjection onto a planar surfaceProjection directions eitherConverge to a pointAre parallel (converge at infinity)15Linear ProjectionA 2D viewOrthographicPerspective16Linear ProjectionOrthographicPerspective17Linear ProjectionOrthographicPerspective18OrthographicPerspectiveNote how different things can be seenParallel lines “meet” at infinityLinear ProjectionA 2D view19Orthographic ProjectionNo foreshorteningParallel lines stay parallelPoor depth cues20Canonical View SpaceCanonical view region3D: [-1,-1,-1] to [+1,+1,+1]Assume looking down -Z axisRecall that “Z is in your face”[1,1,1][-1,-1,-1]-Z21Orthographic ProjectionConvert arbitrary view volume to canonical[1,1,1][-1,-1,-1]-Z22Orthographic ProjectionView vectorUp vectorRight = view X up OriginCenternear,top,rightfar,bottom,left*Assume up is perpendicular to view.23Orthographic ProjectionStep 1: translate center to origin24Orthographic ProjectionStep 1: translate center to originStep 2: rotate view to -Z and up to +Y25Orthographic ProjectionStep 1: translate center to originStep 2: rotate view to -Z and up to +YStep 3: center view volume26Orthographic ProjectionStep 1: translate center to originStep 2: rotate view to -Z and up to +YStep 3: center view volumeStep 4: scale to canonical size27Orthographic ProjectionStep 1: translate center to originStep 2: rotate view to -Z and up to +YStep 3: center view volumeStep 4: scale to canonical sizeM = S · T2· R · T127Orthographic ProjectionStep 1: translate center to originStep 2: rotate view to -Z and up to +YStep 3: center view volumeStep 4: scale to canonical sizeM = S · T2· R · T1M = Mo· Mv28Perspective ProjectionForeshortening: further objects appear smallerSome parallel line stay parallel, most don’tLines still look like linesZ ordering preserved (where we care)29Perspective ProjectionPinhole a.k.a center of projectionImage from D. Forsyth30Perspective ProjectionForeshortening: distant objects appear smallerImage from D. Forsyth31Perspective ProjectionVanishing pointsDepend on the sceneNot intrinsic to camera“One point perspective”32Perspective ProjectionVanishing pointsDepend on the sceneNor intrinsic to camera“Two point perspective”33Perspective ProjectionVanishing pointsDepend on the sceneNot intrinsic to camera“Three point perspective”34Perspective ProjectionuvnView Frustum35Perspective ProjectionViewUpDistance to image planeiY-ZToptBottombNearnFarfCenter36Perspective ProjectionStep 1: Translate center to originY-Z37Perspective ProjectionStep 1: Translate center to originStep 2: Rotate view to -Z, up to +YY-Z38Perspective ProjectionStep 1: Translate center to originStep 2: Rotate view to -Z, up to +YStep 3: Shear center-line to -Z axisY-Z39Perspective ProjectionStep 1: Translate center to originStep 2: Rotate view to -Z, up to +YStep 3: Shear center-line to -Z axisStep 4: Perspective-Z39Perspective ProjectionStep 1: Translate center to originStep 2: Rotate view to -Z, up to +YStep 3: Shear center-line to -Z axisStep 4: Perspective-Z−+01000000100001ififi40Perspective ProjectionStep 4: PerspectivePoints at z=-i stay at z=-iPoints at z=-f stay at z=-fPoints at z=0 goto z=±∞Points at z=-∞ goto z=-(i+f)x and y values divided by -z/iStraight lines stay straightDepth ordering preserved in [-i,-f ]Movement along lines distorted-Z40Perspective ProjectionStep 4: PerspectivePoints at z=-i stay at z=-iPoints at z=-f stay at z=-fPoints at z=0 goto z=±∞Points at z=-∞ goto z=-(i+f)x and y values divided by -z/iStraight lines stay straightDepth ordering preserved in [-i,-f ]Movement along lines


View Full Document

Berkeley COMPSCI 184 - Lecture Notes

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