CS 376 Introduction to Computer Graphics 02 / 21 / 2007 Instructor: Michael Eckmann.

Slides:



Advertisements
Similar presentations
CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Advertisements

Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Projection.
Three-Dimensional Viewing Sang Il Park Sejong University Lots of slides are stolen from Jehee Lee’s.
CS 325 Introduction to Computer Graphics 02 / 24 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
Lecture 3 Sunday, 14 June ENGINEERING GRAPHICS 1E9 Lecture 2: Orthographic Projections.
ENGINEERING GRAPHICS 1E7
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 06 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Classical Viewing CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
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.
IT- 601: Computer Graphics Lecture-11 Mathematics of Projection Jesmin Akhter Lecturer,IIT Jahangirnagar University, Savar, Dhaka,Bangladesh.
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
Visualization and Graphics Introduction
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Transformation & Projection Feng Yu Proseminar Computer Graphics :
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics 3D Viewing and Projections.
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Computer Graphics Bing-Yu Chen National Taiwan University.
MATH 306 Chapter 1.
CS 376 Introduction to Computer Graphics 04 / 20 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 23 / 2007 Instructor: Michael Eckmann.
CS 325 Introduction to Computer Graphics 02 / 22 / 2010 Instructor: Michael Eckmann.
Basic Projections 2D to 3D
CS 325 Introduction to Computer Graphics 02 / 26 / 2010 Instructor: Michael Eckmann.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam 3D Viewing I CIS 736 Computer Graphics Review of Basics 2 of 5: 3D Viewing.
University of North Carolina at Greensboro
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
Projection.
CS552: Computer Graphics Lecture 11: Orthographic Projection.
1 PTT 105/3: Engineering Graphics. TAXONOMY OF PLANAR GEOMETRIC PROJECTIONS PTT 105/3: Engineering Graphics 2 Planar Geometric Projections Parallel Multiview.
Vectors and the Geometry of Space Section 10.4 Lines and Planes in Space 2015.
RAC/RA Projection Types of Projection Simple Projections Generalized Projection.
CS 376 Introduction to Computer Graphics 02 / 14 / 2007 Instructor: Michael Eckmann.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Computer Graphics Lecture 19 PROJECTIONS I Taqdees A. Siddiqi
Projection. Conceptual model of 3D viewing process.
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.
PROJECTIONS PROJECTIONS 1. Transform 3D objects on to a 2D plane using projections 2 types of projections Perspective Parallel In parallel projection,
3D Viewing and Clipping Ming Ouhyoung 歐陽明 Professor Dept. of CSIE and GINM NTU.
COMPUTER GRAPHICS 1/36 Viewing 1 Viewing: Types of Projections Computer Graphics.
CS552: Computer Graphics Lecture 9: Perspective Projection.
University of North Carolina at Greensboro
PERSPECTIVE PROJECTION…...
Projection Our 3-D scenes are all specified in 3-D world coordinates
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
Viewing in 3D Chapter 6.
Three Dimensional Viewing
OpenGL 2D Viewing Pipeline
Planar Geometric Projection Classes
Viewing (Projections)
Viewing (Projections)
Presentation transcript:

CS 376 Introduction to Computer Graphics 02 / 21 / 2007 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS Spring 2007 Today’s Topics Questions? Projections –parallel and perspective projections Perspective projection matrix derivation Orthogonal projection matrix derivation Comments on altering Bresenham's line algorithm to add antialiasing capability View volumes

Michael Eckmann - Skidmore College - CS Spring 2007 Projection terminology Projection –transformation of points in a coordinate system of dimension n to a coordinate system of dimension less than n (from Foley, VanDam, Feiner, Hughes) Planar Geometric Projections –planar means we're projecting onto a plane (2d) --- this plane is called the projection plane (also sometimes the view plane) –geometric means we're using straight (not curved) projectors (projectors are the blue dotted lines on the slide after the next.) –Many projections in cartography are non planar or non geometric. When we use the word projection from here on out, we're talking about Planar Geometric Projection.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Breakdown of Planar Geometric Projections: –Parallel orthographic –top –front –side –axonometric isometric other oblique –cabinet –cavalier –other –Perspective one point two point three point

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types There are many subclasses of projections Projections can be either parallel or perspective. The distance between the center of projection (CoP) (= convergence point in the diagram) and the projection plane is infinity for parallel projections and is finite for perspective projections.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Perspective projections can be 1 (vanishing) point, 2 point or 3 point. Diagrams below show 1 point and 2 point. 3 point perspective would occur if in the 2 point perspective diagram, the vertical lines instead of being parallel, vanished to some point (above or below).

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types The 1 point perspective projection is made when one of the coordinate axes is cut by the projection plane. 2 point is when 2 coordinate axes are cut by the projection plane. And 3 point when all 3 coordinate axes are cut by the projection plane. So, in other words, the 1, 2 and 3 point projections are generated by situating the view plane such that it intersects with either 1, 2 or 3 principle axes (x, y and/or z), respectively.

Michael Eckmann - Skidmore College - CS Spring 2007 Perspective Projection Parallel lines in the world appear parallel in the projection (view plane) if they are parallel to the view plane (e.g. see vertical lines in the figure b) and c) a few slides ago.) Any lines that are parallel to each other in the world, but are not parallel to the view plane will converge to a vanishing point. There are an infinity of vanishing points, because there are an infinity of line directions. There is 1 center of projection for any perspective projection. See handout.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Parallel projections can be orthographic or oblique. Orthographic (aka orthogonal) are those that have the projectors perpendicular (normal) to the view plane. Oblique are those that have the projectors not normal to the view plane.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Orthographic projections can be further divided into top (aka plan), front elevation, side elevation or axonometric. The top, front and side elevation projections are typically used in drafting (Engineering or Architectural drawings.) Think of a view of a building where the projectors are parallel to each other and perpendicular to the view plane and the view plane is either parallel to the top, front or side of a building, and hence only one face of the building will displayed in the view plane. Axonometric projections are orthographic and have the view plane situated so that it is not orthogonal to a principle axis. Isometric projection is the kind of axonometric projection where three faces are displayed on the view plane and the view plane cuts the 3 coordinate axes at equal distances from the origin.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Oblique parallel projections are those that have their projectors not normal to the view plane. Two common kinds of oblique projections are cavalier and cabinet. Cavalier are those whose projector angle is 45 degrees with the projection plane. Cabinet are those whose projector angle is about 63.4 degrees (tan -1 2) with the projection plane. These appear more realistic than cavalier, because lines that are perpendicular to the viewing plane are projected at half length.

Michael Eckmann - Skidmore College - CS Spring 2007 Projection types Recap on the breakdown of Planar Geometric Projections: –Parallel (CoP at infinity) orthographic (projectors normal to the view plane) –top (view plane parallel to x-z plane, orthogonal to y-axis) –front –side –axonometric (see more than one face in the view plane) isometric (see three faces in view plane and view plane intersects the 3 coordinate axes at the same distance from the origin.) other oblique (projectors not normal to the view plane) –cabinet (projector angle is 45 degrees) –cavalier (projector angle is about 63.4 degrees) –other –Perspective (CoP is finite) one point (vanishing point only in one principle direction) two point (vanishing points in two principle directions) three point (vanishing points in three principle directions)

Michael Eckmann - Skidmore College - CS Spring 2007 Perspective Matrix Derivation Now we'll derive the matrix for a perspective projection onto a viewing plane. Assume that the viewing plane is at z=0 Assume that the center of projection is at (0, 0, -d) Given a point in 3 space, what is its projected coordinates on the plane at z=0? Let's draw a diagram on the board.

Michael Eckmann - Skidmore College - CS Spring 2007 Perspective Matrix Derivation Using the parametric equation of a line, the line will go through CoP = (0, 0, -d) and through the point in space that we are projecting P = (x,y,z). The projected point P proj = (x proj, y proj, z proj ), lies on the z=0 plane. x proj = x + t(0-x) = x – tx y proj = y + t(0-y) = y – ty z proj = z + t(-d-z) = z – t ( d+ z) = 0, so t=z/(d+z) substitute t into the x proj and y proj equations to get: x proj = x – x z / (d+z) = (dx + zx – xz) / (d+z) = x / (1 + (z/d)) y proj = y / (1 + (z/d)) How to use this information to generate a matrix that performs the perspective projection?

Michael Eckmann - Skidmore College - CS Spring 2007 One Point Perspecitve Perspective projection onto z=0 plane with CoP at (0,0,-d). [ ] [ x ] [ x ] [ ] [ y ] = [ y ] [ ] [ z ] [ 0 ] [ 0 0 1/d 1 ] [ 1 ] [ (z/d) + 1 ]

Michael Eckmann - Skidmore College - CS Spring 2007 Orthographic Projection What do you think a matrix for an orthographic projection onto the z=0 plane would look like? Orthographic means that the direction of the projectors is parallel to z-axis since the z=0 plane is orthogonal to the z- axis. The difference is that we do not have a finite CoP. Given a point in the world P = (x,y,z), what will be its projected point on the z=0 plane? So, what does the matrix look like?

Michael Eckmann - Skidmore College - CS Spring 2007 Orthographic Projection [ ] [ x ] [ x ] [ ] [ y ] = [ y ] [ ] [ z ] [ 0 ] [ ] [ 1 ] [ 1 ]

Michael Eckmann - Skidmore College - CS Spring 2007 Antialiasing Bresenham This picture only tells part of the story

Michael Eckmann - Skidmore College - CS Spring 2007 Antialiasing Bresenham The picture only tells part of the story It's clear from the picture that dlower = Ydesired – Yk dupper = 1 - dlower Even though we're dealing with slopes of less than 1 and > 0, there are other cases that that picture doesn't display. case 1) when dlower < 0 case 2) when dupper < 0 case 3) shown on last slide when dlower and dupper both > 0 case 4) when line goes right through center of a pixel Picture on the board.

Michael Eckmann - Skidmore College - CS Spring 2007 Antialiasing Bresenham Furthermore there's the issue of which two pixels to turn on y is the y-coordinate that Bresenham calculates for this step The two to turn on is dependent on which case we're in case 1) when dlower < 0 the two pixels y coordinates are y & y – 1 case 2) when dupper < 0 the two pixels y coordinates are y & y + 1 case 3) shown on last slide when dlower and dupper both > 0 if Bresenham would've kept y the same then the two pixels y coordinates are y & y + 1 else y & y – 1

Michael Eckmann - Skidmore College - CS Spring 2007 Antialiasing Bresenham case 4) when actual line goes right through the center of a pixel that happens when the values of dupper and dlower are 0 and 1 (or really close when dealing with floating points) so you can test it by taking the absolute value of the difference between the two and test if this is really close to 1 Anyway, when this happens we only want to turn on one pixel (the one with the y coordinate that Bresenham calculated) at full intensity

Michael Eckmann - Skidmore College - CS Spring 2007 Antialiasing Bresenham As for the intensities of the two pixels –case 1) when dlower < 0 example: dlower = -.2 and dupper = 1.2 make intens1 = 1+ dlower (e.g. 0.8) make intens2 = 1 – intens1 (e.g. 0.2) case 2) when dupper < 0 example: dlower = 1.1 and dupper = -0.1 make intens1 = 1+ dupper (e.g. 0.9) make intens2 = 1 – intens1 (e.g. 0.1) case 3) example: dlower = 0.4 and dupper = 0.6 OR example: dlower = 0.7 and dupper = 0.3 make intens1 = dupper (e.g. 0.6) make intens2 = 1 – intens1 (e.g. 0.4)

Michael Eckmann - Skidmore College - CS Spring 2007 View Volumes Assuming a rectangular viewport and given the CoP (aka Projection Reference Point PRP) we have an infinite view volume. Drawing on board. So, the view volume contains the portion of the world that may be displayed in the viewport --- what is not in the volume is clipped out. To limit the processing (and limit what will be displayed), we typically reduce the view volume to a finite volume. We define 2 planes – Front and Back clipping planes (aka hither and yon). Now the finite view volume is the volume contained within the pyramid between the two clipping planes.

Michael Eckmann - Skidmore College - CS Spring 2007 View Volumes Given a view volume and a projection (e.g. a perspective or parallel projection matrix), objects can be clipped to the view volume by solving simultaneous equations for intersections with the projectors with the view plane. This is computation intensive. A more efficient way is clip against a volume that is easier to clip against. For perspective projections this volume (called the canonical view volume for perspective) is defined by the planes: x = z, x = -z, y = z, y = -z, z = -z min, z = -1 For parallel projection's the canonical view volume is x = 1, x = -1, y = 1, y = -1, z = 0, z = -1