CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections III.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections II.
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Now Playing: Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005.
Lecture 12: Projection CS4670: Computer Vision Noah Snavely “The School of Athens,” Raphael.
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
Introduction to 3D viewing 3D is just like taking a photograph!
Viewing and Projections
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
2/24/04© University of Wisconsin, CS559 Spring 2004 Last Time 3D Transformations –Most are natural extensions of 2D transforms –Rotations can be represented.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics Bing-Yu Chen National Taiwan University.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics Zhen Jiang West Chester University.
10/7/04© University of Wisconsin, CS559 Fall 2004 Last Time Transformations Homogeneous coordinates Directions Rotation Geometry 101 – Points, edges, triangles/polygons.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
University of North Carolina at Greensboro
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Projections Angel: Interactive Computer Graphics.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
A Photograph of two papers
Viewing and Projection
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
OpenGL LAB III.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Rendering Pipeline Fall, 2015.
University of North Carolina at Greensboro
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
Viewing/Projections I Week 3, Fri Jan 25
A Photograph of two papers
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Lecture 13: Cameras and geometry
Computer Graphics (Spring 2003)
Projections and Hidden Surface Removal
Last Time Canonical view pipeline Projection Local Coordinate Space
Type of View Perspective View COP(Center of Plane) Diminution of size
Viewing (Projections)
Interactive Computer Graphics Viewing
Computer Graphics 3Practical Lesson
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

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

Where are we? Rendering Pipeline Modeling Transformation Illumination Viewing Transformation Clipping Projection Rasterization Display

Pinhole Camera Ingredients BoxBox FilmFilm Hole PunchHole PunchResults Pictures!Pictures!Ingredients BoxBox FilmFilm Hole PunchHole PunchResults Pictures!Pictures!

Pinhole Camera Non-zero sized hole Film Plane Pinhole Multiple rays of projection

Pinhole Camera Theoretical Pinhole Film Plane Pinhole One ray of projection

Pinhole Camera Field of View Film Plane Field of View Pinhole Focal Length

Pinhole Camera Field of View Film Plane Field of View Pinhole Focal Length

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

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

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

Moving the COP Perspective vs. Orthographic Views Perspective When COP at infinity, Orthographic View

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

Perspective Projection Our camera must model perspective

Perspective Projection How tall should this bunny be? COP Projection Plane

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’ = ?

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?

A Perspective Projection Matrix Answer:Answer:

Example: Or, in 3-D coordinates: Example:

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

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

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

Pipeline Modelview Perspective Division Projection Clip Rasterize

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

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

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

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

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