of 27

• date post

17-Jan-2016
• Category

## Documents

• view

222

3

TAGS:

Embed Size (px)

### Transcript of CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models

• CS 445 / 645Introduction to Computer GraphicsLecture 10Camera Models

• Where are we?Rendering PipelineModeling TransformationIlluminationViewing TransformationClippingProjectionRasterizationDisplay

• Pinhole CameraIngredientsBoxFilmHole PunchResultsPictures!www.kodak.comwww.pinhole.orgwww.debevec.org

• Pinhole CameraNon-zero sized holeFilm PlanePinholeMultiple raysof projection

• Pinhole CameraTheoretical PinholeFilm PlanePinholeOne rayof projection

• Pinhole CameraField of ViewFilm PlaneField of ViewPinholeFocal Length

• Pinhole CameraField of ViewFilm PlaneField of ViewPinholeFocal Length

• Moving the Film PlaneVarying distance to film planeWhat does this do?Film Planed1Field of ViewPinholed2

• Adding a LensPinhole camera has small aperture (lens opening)Its hard to get enough light to expose the filmLens permits larger aperturesLens permits changing distance to film plane without actually moving the film plane

• Computer Graphic CameraWe use Center of Projection (COP)Projection PlaneCOPProjectionPlane

• Moving the COPPerspective vs. Orthographic ViewsPerspectiveWhen COP at infinity, Orthographic View

• Multi-point PerspectiveOne-point PerpectiveOne Vanishing Point

Two-point PerspectiveTwo Vanishing Pointshttp://www.sanford-artedventures.com/create/tech_2pt_perspective.html

• Perspective ProjectionOur camera must model perspective

• Perspective ProjectionCOPProjection Plane

• Perspective ProjectionThe geometry of the situation is that of similar triangles. View from above:

What is x ? dP (x, y, z)XZView plane(0,0,0)x = ?

• Perspective ProjectionDesired result for a point [x, y, z, 1]T projected onto the view plane:

What could a matrix look like to do this?

• A Perspective Projection MatrixExample:

Or, in 3-D coordinates:

• Homogeneous CoordinatesThe role of w in (x, y, z, w)All 3-D points are described with a four vectorAll 3-D tranformations are represented with 4x4 matrixWhen projected to screen coordinates (rasterization)x, y, and z are divided by points w valueThis allows us to perform perspective foreshortening while preserving the reversibility of the mappingWe can retrieve x, y, and z by multiplying by w

• Perspective ProjectionPerspective projection matrix is not affineParallel lines not preservedPerspective projection is irreversibleMany 3-D points can be mapped to same (x, y, d) on the projection planeNo way to retrieve the unique z values

• Orthographic Camera ProjectionCameras back plane parallel to lensInfinite focal lengthNo perspective convergence

• PipelineModelviewPerspective DivisionProjectionClipRasterize

• OpenGL PipelineProjection matrix is stored in GL_PROJECTION stackThis controls type of cameraAll vertices are multiplied by this matrixGL_MODELVIEW controls camera locationAll vertices are multiplied by this matrix

• Making GL_PROJECTIONglFrustum for perspective projectionsxminxmaxyminymaxnear farCamera looks along zmin/max need not be symmetric about any axisnear and far planes are parallel to plane z=0

• Making GL_PROJECTIONgluPerspective for perspective projectionsfovyaspectnearfar

fovy is the angle between top and bottom of viewing volumeaspect is ratio of width over heightThis volume is symmetricalView plane is parallel to camera

• Making GL_PROJECTIONglOrtho for orthographic projectionsleftrightbottomtopnearfar(left, bottom) and (right, top) define dimensions of projection planenear and far used to clip

• Making GL_PROJECTIONIts like any other matrixThese OpenGL commands just build a matrix for youYou could build the matrix yourselfYou can multiply the GL_PROJECTION matrix by any affine transformation you wishNot typically needed