University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
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 III.
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 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.
Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee.
Introduction to 3D viewing 3D is just like taking a photograph!
Viewing and Projections
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
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.
Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]
Computer Graphics I, Fall 2010 Computer Viewing.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
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.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
Viewing
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Viewing and Projection
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections IV.
Viewing and Projection
CS5500 Computer Graphics April 23, Today’s Topic Details of the front-end of the 3D pipeline: –How to construct the viewing matrix? –How to construct.
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.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Chapter: Viewing.
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
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
3 DIMENSIONAL VIEWING Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Three Dimensional Viewing
Computer Graphics CC416 Week 14 3D Graphics.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Computer Viewing.
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Transformations V, Viewing I Week 3, Fri Jan 22
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
Normalizing Transformation (I)
2D Viewing Pipeline.
“Computer Science is no more about computers than astronomy is about telescopes.” Professor Edsger Dijkstra.
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
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Viewing II Week 4, Mon Jan 25
Projection in 3-D Glenn G. Chappell
Projections and Hidden Surface Removal
Chap 3 Viewing Pipeline Reading:
Viewing III Week 4, Wed Jan 27
Computer Graphics Computer Viewing
Viewing/Projections I Week 3, Fri Jan 25
Window to Viewport Transformations
THREE-DIMENSIONAL VIEWING II
Presentation transcript:

Viewing 4 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2016 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Viewing 4 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2016

Projective Rendering Pipeline object world viewing O2W W2V V2C OCS WCS VCS projection transformation modeling transformation viewing transformation clipping C2N CCS 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 perspective divide normalized device N2D NDCS viewport transformation device DCS

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

Origin Location yet more (possibly confusing) conventions GL 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 500 y y -1 x viewport NDC 1 -1 1 300

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 500 300 -1 1 height width

N2D Transformation Display z range is 0 to 1. gl.depthRange(n,f) can constrain further, but depth = 1 is both max and default reminder: NDC z range is -1 to 1 x y viewport NDC 500 300 -1 1 height width

Device vs. Screen Coordinates viewport/window location wrt actual display not available within GL 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 1024 x 500 y y offset y display height x offset viewport viewport 300 display 768 display width

Projective Rendering Pipeline vertex(x,y,z) object world viewing O2W W2V V2C alter w OCS WCS VCS frustum(...) projection transformation modeling transformation viewing transformation clipping translatef(x,y,z) rotatef(a,x,y,z) .... lookAt(...) C2N / w CCS perspective division normalized device 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 canvas.{w,h} viewport(x,y,a,b) N2D NDCS viewport transformation device DCS

Questions?

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

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

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

Perspective Example / w

Projective Rendering Pipeline following pipeline from top/left to bottom/right: moving object POV glVertex3f(x,y,z) object world viewing alter w O2W W2V V2C OCS WCS VCS glFrustum(...) projection transformation modeling transformation viewing transformation clipping glTranslatef(x,y,z) glRotatef(a,x,y,z) .... gluLookAt(...) C2N / w CCS perspective division normalized device 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 glutInitWindowSize(w,h) glViewport(x,y,a,b) N2D NDCS viewport transformation device DCS

OpenGL Example go back from end of pipeline to beginning: coord frame POV! object world viewing clipping O2W W2V V2C CCS OCS WCS VCS projection transformation modeling transformation viewing transformation CCS gl.viewport(0,0,w,h); THREE.PerspectiveCamera(view angle, aspect, near, far) u_xformMatrix = Identidy() gl.uniformMatrix4fv(u_xformMatrix, false, xformMatrix); torsoGeometry.applyMatrix(u_xformMatrix ); var torso = new THREE.Mesh(torsoGeometry,normalMaterial); scene.add(torso); VCS WCS OCS1

Coord Sys: Frame vs Point read down: transforming between coordinate frames, from frame A to frame B read up: transforming points, up from frame B coords to frame A coords OpenGL command order DCS display D2N N2D gl.Viewport(x,y,a,b) NDCS normalized device N2V glFrustum(...) V2N VCS viewing V2W gluLookAt(...) W2V WCS world W2O glRotatef(a,x,y,z) O2W OCS object glVertex3f(x,y,z) pipeline interpretation

Questions?