12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

GR2 Advanced Computer Graphics AGR
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Projection Matrices CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Viewing and Projections
Projection Matrices Ed Angel
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
3.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 3 Viewing Transformation Getting Started with OpenGL Introduction to Projections.
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
3D Concepts UNIT 3. 3-D Coordinate Spaces Remember what we mean by a 3-D coordinate space x axis y axis z axis P y z x Right-Hand Reference System.
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
1 of 23 New Lecture And Lab Information Lectures: –Thursday 12:00 – 13:00 (room tba) –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00 – 11:00 (A305)
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
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.
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Transformation & Projection Feng Yu Proseminar Computer Graphics :
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
3D Viewing.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics Bing-Yu Chen National Taiwan University.
3D Viewing ( From 3D to 2D) Some of the material in these slides have been adapted from the lecture notes of Prof. Tao Ju from Washington University in.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
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.
University of North Carolina at Greensboro
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
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)
Computer Graphics Lecture 08 Fasih ur Rehman. Last Class Ray Tracing.
Three-Dimensional Viewing Hearn & Baker Chapter 7
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
3-D Transformational Geometry CS418 Computer Graphics John C. Hart.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Viewing and Projection
CS552: Computer Graphics Lecture 11: Orthographic Projection.
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.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Perspective View Volume View Volume Far Near Window Far Near Window Center of Projection Center of Projection (a) Original Orientation (b) After Transformation.
Three-Dimensional Viewing Clipping Computer Graphics C Version (456p - 462p)
Coordinate Systems Lecture 20 Wed, Oct 15, Object Coordinates Each object has its own “local” coordinate system, called object coordinates. Normally.
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.
Viewing in 3D Lecture 11. Viewing in 3D2 u The 3D viewing process is inherently more complex than is the 2D viewing process. F In 2D, we simply specify.
Three Dimensional Viewing
Rendering Pipeline Fall, 2015.
University of North Carolina at Greensboro
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Projection Our 3-D scenes are all specified in 3-D world coordinates
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
3D Clipping.
Projections and Normalization
Viewing (Projections)
Viewing (Projections)
THREE-DIMENSIONAL VIEWING
Presentation transcript:

12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping

12.2 Si23_03 Viewing Pipeline So Far n From the last lecture, we now should understand the viewing pipeline mod’g co-ords world co-ords viewing co-ords Modelling Transform’n Viewing Transform’n The next stage is the projection transformation…. Projection Transform’n

12.3 Si23_03 Perspective and Parallel Projection perspective parallel

12.4 Si23_03 Puzzle from Earlier Lecture

12.5 Si23_03 Ames Room

12.6 Si23_03 Another Example

12.7 Si23_03 Viewing Co-ordinate System viewing co-ordinate system n The viewing transformation has transformed objects into the viewing co-ordinate system, where the camera position is at the origin, looking along the negative z-direction zVzV yVyV xVxV camera direction

12.8 Si23_03 View Volume zVzV yVyV xVxV camera near plane far plane  We determine the view volume by: - view angle,  - aspect ratio of viewplane - distances to near plane d NP and far plane d FP d NP d FP

12.9 Si23_03 Projection We shall project on to the near plane. Remember this is at right angles to the z V direction, and has z-coordinate z NP = - d NP zVzV yVyV xVxV camera near plane d NP

12.10 Si23_03 Perspective Projection Calculation looking down x-axis towards the origin zVzV yVyV xVxV camera near plane d NP z NP zVzV view plane Q camera yVyV z NP zQzQ

12.11 Si23_03 Perspective Projection Calculation zVzV view plane Q camera yVyV z NP zQzQ P By similar triangles, y P / y Q = ( - z NP ) / ( - z Q ) and so y P = y Q * (- z NP ) / ( - z Q ) or y P = y Q * d NP / ( - z Q ) Similarly for the x-coordinate of P: x P = x Q * d NP / ( - z Q )

12.12 Si23_03 Using Matrices and Homogeneous Co-ordinates n We can express the perspective transformation in matrix form n Point Q in homogeneous coordinates is (x Q, y Q, z Q, 1) n We shall generate a point H in homogeneous co-ordinates (x H, y H, z H, w H ), where w H is not 1 n But the point (x H /w H, y H /w H, z H /w H, 1) is the same as H in homogeneous space n This gives us the point P in 3D space, ie x P = x H /w H, sim’ly for y P

12.13 Si23_03 Transformation Matrix for Perspective /d NP 0 xQyQzQ1xQyQzQ1 xHyHzHwHxHyHzHwH = Thus in Homogeneous co-ordinates: x H = x Q ; y H = y Q ; z H = z Q ; w H = (-1/d NP )z Q In Cartesian co-ordinates: x P = x H / w H = x Q *d NP /(-z Q ); y P similar; z P = -d NP = z NP

12.14 Si23_03 OpenGL n Perspective projection achieved by: gluPerspective (angle_of_view, aspect_ratio, near, far) – aspect ratio is width/height – near and far are positive distances

12.15 Si23_03 Vanishing Points vanishing point n When a 3D object is projected onto a view plane using perspective, parallel lines in object NOT parallel to the view plane converge to a vanishing point view plane vanishing point one-point perspective projection of cube

12.16 Si23_03 One- and Two-Point Perspective Drawing

12.17 Si23_03 One-point Perspective Said to be the first painting in perspective This is: Trinity with the Virgin, St John and Donors, by Mastaccio in 1427

12.18 Si23_03 Two-point Perspective Edward Hopper Lighthouse at Two Lights -see

12.19 Si23_03 Parallel Projection - Two types n Orthographic n Orthographic parallel projection has view plane perpendicular to direction of projection n Oblique n Oblique parallel projection has view plane at an oblique angle to direction of projection P1 P2 view plane P1 P2 view plane orthographic projection We shall only consider orthographic projection

12.20 Si23_03 Parallel Projection Calculation zVzV yVyV xVxV near plane d NP zVzV view plane Q yVyV looking down x-axis z NP zQzQ P y P = y Q similarly x P = x Q

12.21 Si23_03 Parallel Projection Calculation n So this is much easier than perspective! – x P = x Q – y P = y Q – z P = z NP n The transformation matrix is simply z NP /z Q

12.22 Si23_03 Clipping

12.23 Si23_03 View Frustum and Clipping zVzV yVyV xVxV camera near plane far plane  The view volume is a frustum in viewing co-ordinates - we need to be able to clip objects outside of this region d NP d FP

12.24 Si23_03 Clipping to View Frustum n It is quite easy to clip lines to the front and back planes (just clip in z).. n.. but it is difficult to clip to the sides because they are ‘sloping’ planes n Instead we carry out the projection first which converts the frustum to a rectangular parallelepiped (ie a cuboid) Retain the Z-coord

12.25 Si23_03 Clipping for Parallel Projection n In the parallel projection case, the viewing volume is already a rectangular parallelepiped far plane near plane zVzV view volume

12.26 Si23_03 Normalized Projection Co-ordinates normalize n Final step before clipping is to normalize the co-ordinates of the rectangular parallelepiped to some standard shape – for example, in some systems, it is the cube with limits +1 and -1 in each direction scale n This is just a scale transformation n Clipping is then carried out against this standard shape

12.27 Si23_03 Viewing Pipeline So Far n Our pipeline now looks like: mod’g co-ords world co-ords view’g co-ords proj’n co-ords normalized projection co-ordinates NORMALIZATION TRANSFORMATION

12.28 Si23_03 Viewport Transformation

12.29 Si23_03 And finally... n The last step is to position the picture on the display surface viewport transformation n This is done by a viewport transformation where the normalized projection co-ordinates are transformed to display co-ordinates, ie pixels on the screen

12.30 Si23_03 Viewing Pipeline - The End n A final viewing pipeline is therefore: mod’g co-ords world co-ords view’g co-ords proj’n co-ords normalized projection co-ordinates device co-ordinates DEVICE TRANSFORMATION