University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.

Slides:



Advertisements
Similar presentations
1 Computer Graphics Chapter 8 3D Transformations.
Advertisements

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections IV.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Projections II Week 4,
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.
Camera Models A camera is a mapping between the 3D world and a 2D image The principal camera of interest is central projection.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections III.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Viewing, Projections.
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
Announcements. Projection Today’s Readings Nalwa 2.1.
Projections and Picking Wed 24 Sep 2003
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Wed 17 Oct 2003 project 1 recap: display lists viewing.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
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 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Mon 22 Sep 2003 project 1 solution demo recap: projections.
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
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.
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 고려대학교 컴퓨터 그래픽스 연구실.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Computer Graphics Bing-Yu Chen National Taiwan University.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
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.
Viewing
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections IV.
A Photograph of two papers
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
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.
Modeling and The Viewing Pipeline Jian Huang CS594 The material in this set of slides have referenced slides from Ohio State, Minnesota and MIT.
OpenGL LAB III.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Computer Graphics Projections.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Final Review I University of British Columbia
Rendering Pipeline Fall, 2015.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
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.
Lecture 9: Projection Li Zhang Spring 2008
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CENG 477 Introduction to Computer Graphics
Viewing/Projections I Week 3, Fri Jan 25
A Photograph of two papers
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Lecture 13: Cameras and geometry
Viewing II Week 4, Mon Jan 25
Last Time Canonical view pipeline Projection Local Coordinate Space
Viewing (Projections)
Viewing III Week 4, Wed Jan 27
Viewing (Projections)
Viewing/Projections I Week 3, Fri Jan 25
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I Week 3, Fri Jan 25

2 Review: Camera Motion rotate/translate/scale difficult to control arbitrary viewing position eye point, gaze/lookat direction, up vector Peye Pref up view eye lookat y z x WCS

3 Review: World to View Coordinates translate eye to origin rotate view vector (lookat – eye) to w axis rotate around w to bring up into vw-plane y z x WCS v u VCS Peye w Pref up view eye lookat

4 Projections I

5 Pinhole Camera ingredients box, film, hole punch result picture

6 Pinhole Camera theoretical perfect pinhole light shining through tiny hole into dark space yields upside-down picture film plane perfect pinhole one ray of projection

7 Pinhole Camera non-zero sized hole blur: rays hit multiple points on film plane film plane actual pinhole multiple rays of projection

8 Real Cameras pinhole camera has small aperture (lens opening) minimize blur problem: hard to get enough light to expose the film solution: lens permits larger apertures permits changing distance to film plane without actually moving it cost: limited depth of field where image is in focus aperture lens depthoffield

9 Graphics Cameras real pinhole camera: image inverted imageplane eye point point computer graphics camera: convenient equivalent imageplane eye point point center of projection

10 General Projection image plane need not be perpendicular to view plane imageplane eye point point imageplane eye

11 Perspective Projection our camera must model perspective

12 Perspective Projection our camera must model perspective

13 Projective Transformations planar geometric projections planar: onto a plane geometric: using straight lines projections: 3D -> 2D aka projective mappings counterexamples?

14 Projective Transformations properties lines mapped to lines and triangles to triangles parallel lines do NOT remain parallel e.g. rails vanishing at infinity affine combinations are NOT preserved e.g. center of a line does not map to center of projected line (perspective foreshortening)

15 Perspective Projection project all geometry through common center of projection (eye point) onto an image plane x z x z y x -z

16 Perspective Projection how tall should this bunny be? projection plane center of projection (eye point)

17 Basic Perspective Projection similar triangles z P(x,y,z) P(x’,y’,z’) z’=d y nonuniform foreshortening not affine but

18 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?

19 Simple Perspective Projection Matrix

20 Simple Perspective Projection Matrix is homogenized version of where w = z/d

21 Simple Perspective Projection Matrix is homogenized version of where w = z/d

22 Perspective Projection expressible with 4x4 homogeneous matrix use previously untouched bottom row perspective projection is irreversible many 3D points can be mapped to same (x, y, d) on the projection plane no way to retrieve the unique z values

23 Moving COP to Infinity as COP moves away, lines approach parallel when COP at infinity, orthographic view

24 Orthographic Camera Projection camera’s back plane parallel to lens infinite focal length no perspective convergence just throw away z values

25 Perspective to Orthographic transformation of space center of projection moves to infinity view volume transformed from frustum (truncated pyramid) to parallelepiped (box) -z x -z x Frustum Parallelepiped

26 View Volumes specifies field-of-view, used for clipping restricts domain of z stored for visibility test z perspective view volume orthographic view volume x=left x=right y=top y=bottom z=-near z=-far x VCS x z y y x=left y=top x=right z=-far z=-near y=bottom

27 Canonical View Volumes standardized viewing volume representation perspective orthographic orthogonal parallel x or y -z 1 front plane back plane x or y -z front plane back plane x or y = +/- z

28 Why Canonical View Volumes? permits standardization clipping easier to determine if an arbitrary point is enclosed in volume with canonical view volume vs. clipping to six arbitrary planes rendering projection and rasterization algorithms can be reused

29 Normalized Device Coordinates convention viewing frustum mapped to specific parallelepiped Normalized Device Coordinates (NDC) same as clipping coords only objects inside the parallelepiped get rendered which parallelepiped? depends on rendering system

30 Normalized Device Coordinates left/right x =+/- 1, top/bottom y =+/- 1, near/far z =+/- 1 -z x Frustum z=-n z=-f right left z x x= -1 z=1 x=1 Camera coordinates NDC z= -1

31 Understanding Z z axis flip changes coord system handedness RHS before projection (eye/view coords) LHS after projection (clip, norm device coords) x z VCS y x=left y=top x=right z=-far z=-near y=bottom x z NDCS y (-1,-1,-1) (1,1,1)

32 Understanding Z near, far always positive in OpenGL calls glOrtho(left,right,bot,top,near,far); glOrtho(left,right,bot,top,near,far); glFrustum(left,right,bot,top,near,far); glFrustum(left,right,bot,top,near,far); glPerspective(fovy,aspect,near,far); glPerspective(fovy,aspect,near,far); orthographic view volume x z VCS y x=left y=top x=right z=-far z=-near y=bottom perspective view volume x=left x=right y=top y=bottom z=-near z=-far x VCS y

33 Understanding Z why near and far plane? near plane: avoid singularity (division by zero, or very small numbers) far plane: store depth in fixed-point representation (integer), thus have to have fixed range of values (0…1) avoid/reduce numerical precision artifacts for distant objects

34 Orthographic Derivation scale, translate, reflect for new coord sys x z VCS y x=left y=top x=right z=-far z=-near y=bottom x z NDCS y (-1,-1,-1) (1,1,1)

35 Orthographic Derivation scale, translate, reflect for new coord sys x z VCS y x=left y=top x=right z=-far z=-near y=bottom x z NDCS y (-1,-1,-1) (1,1,1)

36 Orthographic Derivation scale, translate, reflect for new coord sys

37 Orthographic Derivation scale, translate, reflect for new coord sys x z VCS y x=left y=top x=right z=-far z=-near y=bottom same idea for right/left, far/near

38 Orthographic Derivation scale, translate, reflect for new coord sys

39 Orthographic Derivation scale, translate, reflect for new coord sys

40 Orthographic Derivation scale, translate, reflect for new coord sys

41 Orthographic Derivation scale, translate, reflect for new coord sys

42 Orthographic OpenGL glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(left,right,bot,top,near,far);