Download presentation
Presentation is loading. Please wait.
Published byKellie Parker Modified over 9 years ago
1
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models
2
Where are we? Rendering Pipeline Modeling Transformation Illumination Viewing Transformation Clipping Projection Rasterization Display
3
Pinhole Camera Ingredients BoxBox FilmFilm Hole PunchHole PunchResults Pictures!Pictures!Ingredients BoxBox FilmFilm Hole PunchHole PunchResults Pictures!Pictures! www.kodak.com www.pinhole.org www.debevec.org
4
Pinhole Camera Non-zero sized hole Film Plane Pinhole Multiple rays of projection
5
Pinhole Camera Theoretical Pinhole Film Plane Pinhole One ray of projection
6
Pinhole Camera Field of View Film Plane Field of View Pinhole Focal Length
7
Pinhole Camera Field of View Film Plane Field of View Pinhole Focal Length
8
Moving the Film Plane Varying distance to film plane What does this do? Varying distance to film plane What does this do? Film Plane d1d1 Field of View Pinhole d2d2
9
Adding a Lens Pinhole camera has small aperture (lens opening)Pinhole camera has small aperture (lens opening) –It’s hard to get enough light to expose the film Lens permits larger aperturesLens permits larger apertures Lens permits changing distance to film plane without actually moving the film planeLens permits changing distance to film plane without actually moving the film plane Pinhole camera has small aperture (lens opening)Pinhole camera has small aperture (lens opening) –It’s hard to get enough light to expose the film Lens permits larger aperturesLens permits larger apertures Lens permits changing distance to film plane without actually moving the film planeLens permits changing distance to film plane without actually moving the film plane
10
Computer Graphic Camera We use Center of Projection (COP)Center of Projection (COP) Projection PlaneProjection Plane We use Center of Projection (COP)Center of Projection (COP) Projection PlaneProjection Plane COP Projection Plane
11
Moving the COP Perspective vs. Orthographic Views Perspective When COP at infinity, Orthographic View
12
Multi-point Perspective One-point Perpective One Vanishing PointOne Vanishing Point Two-point Perspective Two Vanishing PointsTwo Vanishing Points One-point Perpective One Vanishing PointOne Vanishing Point Two-point Perspective Two Vanishing PointsTwo Vanishing Points http://www.sanford-artedventures.com/create/tech_2pt_perspective.html
13
Perspective Projection Our camera must model perspective
14
Perspective Projection How tall should this bunny be? COP Projection Plane
15
Perspective Projection The geometry of the situation is that of similar triangles. View from above: What is x’ ? The geometry of the situation is that of similar triangles. View from above: What is x’ ? d P (x, y, z)X Z View plane (0,0,0) x’ = ?
16
Perspective Projection Desired result for a point [x, y, z, 1] T projected onto the view plane: What could a matrix look like to do this? Desired result for a point [x, y, z, 1] T projected onto the view plane: What could a matrix look like to do this?
17
A Perspective Projection Matrix Answer:Answer:
18
Example: Or, in 3-D coordinates: Example:
19
Homogeneous Coordinates The role of w in (x, y, z, w) All 3-D points are described with a four vectorAll 3-D points are described with a four vector All 3-D tranformations are represented with 4x4 matrixAll 3-D tranformations are represented with 4x4 matrix When projected to screen coordinates (rasterization)When projected to screen coordinates (rasterization) –x, y, and z are divided by point’s w value This allows us to perform perspective foreshortening while preserving the reversibility of the mappingThis allows us to perform perspective foreshortening while preserving the reversibility of the mapping –We can retrieve x, y, and z by multiplying by w The role of w in (x, y, z, w) All 3-D points are described with a four vectorAll 3-D points are described with a four vector All 3-D tranformations are represented with 4x4 matrixAll 3-D tranformations are represented with 4x4 matrix When projected to screen coordinates (rasterization)When projected to screen coordinates (rasterization) –x, y, and z are divided by point’s w value This allows us to perform perspective foreshortening while preserving the reversibility of the mappingThis allows us to perform perspective foreshortening while preserving the reversibility of the mapping –We can retrieve x, y, and z by multiplying by w
20
Perspective Projection Perspective projection matrix is not affinePerspective projection matrix is not affine –Parallel lines not preserved Perspective projection is irreversiblePerspective projection is irreversible –Many 3-D points can be mapped to same (x, y, d) on the projection plane –No way to retrieve the unique z values Perspective projection matrix is not affinePerspective projection matrix is not affine –Parallel lines not preserved Perspective projection is irreversiblePerspective projection is irreversible –Many 3-D points can be mapped to same (x, y, d) on the projection plane –No way to retrieve the unique z values
21
Orthographic Camera Projection Camera’s back plane parallel to lensCamera’s back plane parallel to lens Infinite focal lengthInfinite focal length No perspective convergenceNo perspective convergence Camera’s back plane parallel to lensCamera’s back plane parallel to lens Infinite focal lengthInfinite focal length No perspective convergenceNo perspective convergence
22
Pipeline Modelview Perspective Division Projection Clip Rasterize
23
OpenGL Pipeline Projection matrix is stored in GL_PROJECTION stackProjection matrix is stored in GL_PROJECTION stack –This controls ‘type’ of camera –All vertices are multiplied by this matrix GL_MODELVIEW controls camera locationGL_MODELVIEW controls camera location –All vertices are multiplied by this matrix Projection matrix is stored in GL_PROJECTION stackProjection matrix is stored in GL_PROJECTION stack –This controls ‘type’ of camera –All vertices are multiplied by this matrix GL_MODELVIEW controls camera locationGL_MODELVIEW controls camera location –All vertices are multiplied by this matrix
24
Making GL_PROJECTION glFrustum – for perspective projections xminxmin xmaxxmax yminymin ymaxymax nearnear farfar glFrustum – for perspective projections xminxmin xmaxxmax yminymin ymaxymax nearnear farfar Camera looks along –zCamera looks along –z min/max need not be symmetric about any axismin/max need not be symmetric about any axis near and far planes are parallel to plane z=0near and far planes are parallel to plane z=0 Camera looks along –zCamera looks along –z min/max need not be symmetric about any axismin/max need not be symmetric about any axis near and far planes are parallel to plane z=0near and far planes are parallel to plane z=0
25
Making GL_PROJECTION gluPerspective – for perspective projections fovyfovy aspectaspect nearnear farfar gluPerspective – for perspective projections fovyfovy aspectaspect nearnear farfar fovy is the angle between top and bottom of viewing volumefovy is the angle between top and bottom of viewing volume aspect is ratio of width over heightaspect is ratio of width over height This volume is symmetricalThis volume is symmetrical View plane is parallel to cameraView plane is parallel to camera fovy is the angle between top and bottom of viewing volumefovy is the angle between top and bottom of viewing volume aspect is ratio of width over heightaspect is ratio of width over height This volume is symmetricalThis volume is symmetrical View plane is parallel to cameraView plane is parallel to camera
26
Making GL_PROJECTION glOrtho – for orthographic projections leftleft rightright bottombottom toptop nearnear farfar glOrtho – for orthographic projections leftleft rightright bottombottom toptop nearnear farfar (left, bottom) and (right, top) define dimensions of projection plane(left, bottom) and (right, top) define dimensions of projection plane near and far used to clipnear and far used to clip (left, bottom) and (right, top) define dimensions of projection plane(left, bottom) and (right, top) define dimensions of projection plane near and far used to clipnear and far used to clip
27
Making GL_PROJECTION It’s like any other matrix These OpenGL commands just build a matrix for youThese OpenGL commands just build a matrix for you You could build the matrix yourselfYou could build the matrix yourself You can multiply the GL_PROJECTION matrix by any affine transformation you wishYou can multiply the GL_PROJECTION matrix by any affine transformation you wish –Not typically needed It’s like any other matrix These OpenGL commands just build a matrix for youThese OpenGL commands just build a matrix for you You could build the matrix yourselfYou could build the matrix yourself You can multiply the GL_PROJECTION matrix by any affine transformation you wishYou can multiply the GL_PROJECTION matrix by any affine transformation you wish –Not typically needed
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.