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

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Projection.
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.
Transformations II Week 2, Wed Jan 17
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
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.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Vision/Color Week 5, Mon.
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.
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.
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
Computer Graphics (fall 2009)
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.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics Bing-Yu Chen National Taiwan University.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
CS 325 Introduction to Computer Graphics 02 / 22 / 2010 Instructor: Michael Eckmann.
Basic Projections 2D to 3D
University of North Carolina at Greensboro
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
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
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Viewing
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
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.
Viewing and Projection
CS552: Computer Graphics Lecture 11: Orthographic Projection.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Viewing/Projection V,
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.
Computer Graphics Projections.
PROJECTIONS PROJECTIONS 1. Transform 3D objects on to a 2D plane using projections 2 types of projections Perspective Parallel In parallel projection,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Rendering Pipeline Fall, 2015.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
University of North Carolina at Greensboro
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Transformations V, Viewing I Week 3, Fri Jan 22
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
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
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics (Spring 2003)
Viewing II Week 4, Mon Jan 25
Chap 3 Viewing Pipeline Reading:
Viewing III Week 4, Wed Jan 27
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 IV Week 4, Fri Feb 1

2 News extra TA office hours in lab next week to answer questions Mon 1-3 Tue 2-4 Wed 1-3 reminder Wed 2/6: Homework 1 due 1pm sharp Wed 2/6: Project 1 due 6pm.

3 Review: 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

4 Review: 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)

5 Review: 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

6 Review: 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

7 Review: 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

8 Reading for Viewing FCG Chapter 7 Viewing FCG Section Windowing Transforms RB rest of Chap Viewing RB rest of App Homogeneous Coords

9 Reading for Next Time RB Chap Color FCG Sections FCG Chap 20 Color FCG Chap Visual Perception (Color)

10 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

11 NDC to Device Transformation map from NDC to pixel coordinates on display NDC range is x = , y = , z = typical display range: x = , y = maximum is size of actual screen z range max and default is (0, 1), use later for visibility x y viewport NDC x y glViewport(0,0,w,h); glDepthRange(0,1); // depth = 1 by default

12 Origin Location yet more (possibly confusing) conventions OpenGL origin: lower left most window systems origin: upper left then must reflect in y when interpreting mouse position, have to flip your y coordinates x y viewport NDC x y

13 N2D Transformation general formulation reflect in y for upper vs. lower left origin scale by width, height, depth translate by width/2, height/2, depth/2 FCG includes additional translation for pixel centers at (.5,.5) instead of (0,0) x y viewport NDC height width x y

14 N2D Transformation x y viewport NDC height width x y

15 Device vs. Screen Coordinates viewport/window location wrt actual display not available within OpenGL usually don’t care use relative information when handling mouse events, not absolute coordinates could get actual display height/width, window offsets from OS loose use of terms: device, display, window, screen... x display viewport display height display width x offset y offset y viewport x 0 0 y

16 Projective Rendering Pipeline OCS - object coordinate system WCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system OCS WCS VCS CCS NDCS DCSmodelingtransformationviewingtransformationprojectiontransformationviewporttransformation alter w / w objectworld viewing device normalized device clipping perspectivedivision glVertex3f(x,y,z) glTranslatef(x,y,z)glRotatef(a,x,y,z)....gluLookAt(...) glFrustum(...) glutInitWindowSize(w,h)glViewport(x,y,a,b) O2WW2VV2C N2D C2N

17 Coordinate Systems viewing (4-space, W=1) clipping (4-space parallelepiped, with COP moved backwards to infinity normalized device (3-space parallelepiped) device (3-space parallelipiped) projection matrix divide by w scale & translate framebuffer

18 Perspective To NDCS Derivation x z NDCS y (-1,-1,-1) (1,1,1) x=left x=right y=top y=bottom z=-near z=-far x VCS y z

19 Perspective Derivation simple example earlier: complete: shear, scale, projection-normalization

20 Perspective Derivation earlier: complete: shear, scale, projection-normalization

21 Perspective Derivation earlier: complete: shear, scale, projection-normalization

22 Perspective Derivation

23 Perspective Derivation similarly for other 5 planes 6 planes, 6 unknowns

24 Perspective Example tracks in VCS: left x=-1, y=-1 right x=1, y=-1 view volume left = -1, right = 1 bot = -1, top = 1 near = 1, far = 4 z=-1 z=-4 x z VCS top view 1 1 NDCS (z not shown) real midpoint 0 xmax-1 0 DCS (z not shown) ymax-1 x=-1 x=1

25 Perspective Example view volume left = -1, right = 1 bot = -1, top = 1 near = 1, far = 4

26 Perspective Example / w

27 OpenGL Example glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective( 45, 1.0, 0.1, ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, -5.0 ); glPushMatrix() glTranslate( 4, 4, 0 ); glutSolidTeapot(1); glPopMatrix(); glTranslate( 2, 2, 0); glutSolidTeapot(1); OCS2 O2W VCSmodelingtransformationviewingtransformation projectiontransformation objectworld viewing W2VV2C WCS transformations that are applied first are specified last OCS1 WCS VCS W2O W2O CCS clipping CCS OCS

28 Projection Taxonomy planarprojections perspective:1,2,3-point parallel oblique orthographic cabinet cavalier top,front,side axonometric:isometricdimetrictrimetric perspective: projectors converge orthographic, axonometric: projectors parallel and perpendicular to projection plane oblique: projectors parallel, but not perpendicular to projection plane

29 Perspective Projections projectors converge on image plane select how many vanishing points one-point: projection plane parallel to two axes two-point: projection plane parallel to one axis three-point: projection plane not parallel to any axis one-pointperspective two-pointperspective three-pointperspective Tuebingen demo: vanishingpoints

30 Orthographic Projections projectors parallel, perpendicular to image plane image plane normal parallel to one of principal axes select view: top, front, side every view has true dimensions, good for measuring

31 Axonometric Projections projectors parallel, perpendicular to image plane image plane normal not parallel to axes select axis lengths can see many sides at once

32 Oblique Projections x y z cavalier d d x y z cabinet d d / 2 projectors parallel, oblique to image plane select angle between front and z axis lengths remain constant both have true front view cavalier: distance true cabinet: distance half Tuebingen demo: oblique projections