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

Slides:



Advertisements
Similar presentations
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Advertisements

1 Computer Graphics Chapter 8 3D Transformations.
Three-Dimensional Viewing Sang Il Park Sejong University Lots of slides are stolen from Jehee Lee’s.
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 2007 Tamara Munzner Viewing/Projections II.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections III.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Viewing, Projections.
Projection Matrices CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
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.
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.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Viewing and Projections Mon 22 Sep 2003 project 1 solution demo recap: projections.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Midterm Review Week 7, Wed 16 Oct 2003 midterm review project 1 demos, hall.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
Viewing and Projections
Computer Graphics (fall 2009)
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.
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.
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.
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Three-Dimensional Viewing
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.
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.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
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
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
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
OpenGL 2D Viewing Pipeline
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Viewing II Week 4, Mon Jan 25
Last Time Canonical view pipeline Projection Local Coordinate Space
Chap 3 Viewing Pipeline Reading:
Viewing III Week 4, Wed Jan 27
Viewing (Projections)
Viewing/Projections I Week 3, Fri Jan 25
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections III Week 4, Wed Jan 30

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

3 Review: Basic Perspective Projection similar triangles z P(x,y,z) P(x’,y’,z’) z’=d y homogeneouscoords

4 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

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

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

7 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

8 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

9 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

10 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

11 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

12 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

13 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)

14 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

15 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

16 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)

17 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)

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

19 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

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

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

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

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

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

25 Demo Brown applets: viewing techniques parallel/orthographic cameras projection cameras /viewing_techniques.html

26 Projections II

27 Asymmetric Frusta our formulation allows asymmetry why bother? -z x Frustum right left -z x Frustum z=-n z=-f right left

28 Asymmetric Frusta our formulation allows asymmetry why bother? binocular stereo view vector not perpendicular to view plane Right Eye Left Eye

29 Simpler Formulation left, right, bottom, top, near, far nonintuitive often overkill look through window center symmetric frustum constraints left = -right, bottom = -top

30 Field-of-View Formulation FOV in one direction + aspect ratio (w/h) determines FOV in other direction also set near, far (reasonably intuitive) -z x Frustum z=-n z=-f  fovx/2 fovy/2 h w

31 Perspective OpenGL glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(left,right,bot,top,near,far); or glPerspective(fovy,aspect,near,far);

32 Demo: Frustum vs. FOV Nate Robins tutorial (take 2):

33 Projective Rendering Pipeline OCS - object/model coordinate system WCS - world coordinate system VCS - viewing/camera/eye coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device/display/screen coordinate system OCS O2W VCS CCS NDCS DCSmodelingtransformationviewingtransformation projectiontransformation viewporttransformation perspective divide objectworld viewing device normalized device clipping W2VV2C N2D C2N WCS

34 Projection Normalization warp perspective view volume to orthogonal view volume render all scenes with orthographic projection! aka perspective warp x z=  z=d x z=0 z=d

35 Perspective Normalization perspective viewing frustum transformed to cube orthographic rendering of cube produces same image as perspective rendering of original frustum

36 Predistortion

37 Demos Tuebingen applets from Frank Hanisch AppletIndex.html#Transformationen

38 Projective Rendering Pipeline OCS - object/model coordinate system WCS - world coordinate system VCS - viewing/camera/eye coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device/display/screen coordinate system OCS O2W VCS CCS NDCS DCSmodelingtransformationviewingtransformation projectiontransformation viewporttransformation perspective divide objectworld viewing device normalized device clipping W2VV2C N2D C2N WCS

39 Separate Warp From Homogenization warp requires only standard matrix multiply distort such that orthographic projection of distorted objects is desired persp projection w is changed clip after warp, before divide division by w: homogenization CCS NDCS alter w / w VCS projectiontransformation viewing normalized device clipping perspectivedivision V2CC2N

40 Perspective Divide Example specific example assume image plane at z = -1 a point [x,y,z,1] T projects to [-x/z,-y/z,-z/z,1] T  [x,y,z,-z] T -z

41 Perspective Divide Example alter w / w projectiontransformation perspectivedivision after homogenizing, once again w=1

Perspective Normalization matrix formulation warp and homogenization both preserve relative depth (z coordinate)

43 Demo Brown applets: viewing techniques parallel/orthographic cameras projection cameras /viewing_techniques.html