CS 551 / 645: Introductory Computer Graphics Viewing Transforms.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Computer Graphics Lecture 4 Geometry & Transformations.
Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
3-D Geometry.
Lecture 3 – Transformation And Coordinate Systems
MSU CSE 803 Fall 2008 Stockman1 CV: 3D sensing and calibration Coordinate system changes; perspective transformation; Stereo and structured light.
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Larry F. Hodges (modified by Amos Johnson) 1 2D Transformations.
CS 450: Computer Graphics 2D TRANSFORMATIONS
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Mathematical Fundamentals
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Viewing and Projections
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
Transformation & Projection Feng Yu Proseminar Computer Graphics :
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Computer Graphics Bing-Yu Chen National Taiwan University.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Geometric Objects and Transformation
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Angel: Interactive Computer Graphics CSE 409: Computer Graphics Camera Transformations and Projection Acknowledgements: parts of information and pictures.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
Basic 3D Concepts. Overview 1.Coordinate systems 2.Transformations 3.Projection 4.Rasterization.
University of North Carolina at Greensboro
Computer Graphics 3D Transformations. Translation.
Geometric Transformations
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Projections Angel: Interactive Computer Graphics.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
A Photograph of two papers
Computer Graphics Matrices
Viewing and Projection

Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Digital Image Processing Additional Material : Imaging Geometry 11 September 2006 Digital Image Processing Additional Material : Imaging Geometry 11 September.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Unit 10 Transformations. Lesson 10.1 Dilations Lesson 10.1 Objectives Define transformation (G3.1.1) Differentiate between types of transformations (G3.1.2)
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 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 Graphic 2 D Transformation.
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CENG 477 Introduction to Computer Graphics
Three Dimensional Viewing
Perspective Transformation
Chapter V Vertex Processing
Last Time Canonical view pipeline Projection Local Coordinate Space
Viewing (Projections)
Viewing (Projections)
Presentation transcript:

CS 551 / 645: Introductory Computer Graphics Viewing Transforms

Administrivia l Assignment 2 is online - get started this weekend l Midterm will be before reading break - Oct 19 l Today’s reading material: FvD, Chapter 6

Translations l Moving an object is called a translation. We translate a point by adding to the x and y coordinates, respectively, the amount the point should be shifted in the x and y directions. We translate an object by translating each vertex in the object. x new = x old + t x ; y new = y old + t y tyty txtx

Scaling l Changing the size of an object is called a scale. We scale an object by scaling the x and y coordinates of each vertex in the object. s x =w new /w old s y =h new /h old x new = s x x old y new = s y y old w old w new h old h new

Rotation about the Origin l To rotate a line or polygon, we must rotate each of its vertices. l We want to rotate point (x 1,y 1 ) to point (x 2,y 2 ) through angle B From the illustration we know that: sin (A + B) = y 2 /rcos (A + B) = x 2 /r sin A = y 1 /rcos A = x 1 /r x-axis (x1,y1) (x2,y2) A B r (0,0) y-axis

Rotation about the origin (cont.) From the double angle formulas:sin (A + B) = sinAcosB + cosAsinB Substituting:y 2 /r = (y 1 /r)cosB + (x 1 /r)sinB Therefore: y 2 = y 1 cosB + x 1 sinB We have x 2 = x 1 cosB - y 1 sinB y 2 = x 1 sinB + y 1 cosB

Transformations as matrices Scale: x new = s x x old y new = s y y old Rotation: x 2 = x 1 cos  - y 1 sin  y 2 = x 1 sin  + y 1 cos  Translation: x new = x old + t x y new = y old + t y

Homogeneous Coordinates In order to represent a translation as a matrix multiplication operation we use 3 x 3 matrices and pad our points to become 3 x 1 matrices. This coordinate system (using three values to represent a 2D point) is called homogeneous coordinates.

Composite Transformations Suppose we wished to perform multiple transformations on a point: Remember: Matrix multiplication is associative, not commutative! Transform matrices must be pre-multiplied The first transformation you want to perform will be at the far right, just before the point

Composite Transforms - Scaling (cont.) l If we scale a line between (0,0) & (2,0) to twice its length, the left-hand endpoint does not move. (0,0) is known as a fixed point for the basic scaling transformation. We can use composite transformations to create a scale transformation with different fixed points Before After

Fixed Point Scaling Scale by 2 with fixed point = (2,1) l Translate the point (2,1) to the origin l Scale by 2 Translate origin to point (2,1) Before After

Rotation about a Fixed Point Rotation Of  Degrees About Point (x,y) l Translate (x,y) to origin l Rotate l Translate origin to (x,y)

Shears Original Datay Shearx Shear

Reflections Reflection about the y-axisReflection about the x-axis

More Reflections Reflection about the originReflection about the line y=x ? ?

Transformations as a change in coordinate system l All transformations we have looked at involve transforming points in a fixed coordinate system (CS). l Can also think of them as a transformation of the CS itself

Transforming the CS - examples Translate(4,4) Rotate(180°)

Why transform the CS? l Objects often defined in a “natural” or “convenient” CS l To draw objects transformed by T, we could: –Transform each vertex by T, then draw –Or, draw vertices in a transformed CS (2,2)

Drawing in transformed CS l Tell system once how to draw the object, then draw in a transformed CS to transform the object House drawn in a CS that’s been translated, rotated, and scaled M = S x,y R d T x,y

Projecting 3-D into 2-D l Rotations and translations are sufficient to convert 3D to 2D l We frequently map from world space (3D) into eye space (2D) l Create a special class of transformations for this mapping: viewing transformations

A 3D Scene l Notice the presence of the camera, the projection plane, and the world coordinate axes l Viewing transformations define how to acquire the image on the projection plane

Viewing Transformations l Create a camera-centered view l Camera is at origin l Camera is looking along negative z-axis l Camera’s ‘up’ is aligned with y-axis

2 Basic Steps l Align the two coordinate frames by rotation

2 Basic Steps l Translate to align origins

Creating Camera Coordinate Space l Specify a point where the camera is located in world space, the eye point l Specify a point in world space that we wish to become the center of view, the lookat point l Specify a vector in world space that we wish to point up in camera image, the up vector l Intuitive camera movement

Constructing Viewing Transformation, V l Create a vector from eye-point to lookat-point l Normalize the vector l Desired rotation matrix should map this vector to [0, 0, -1] T Why?

Constructing Viewing Transformation, V l Construct another important vector from the cross product of the lookat-vector and the vup-vector l This vector, when normalized, should align with [1, 0, 0] T Why?

Constructing Viewing Transformation, V l One more vector to define… l This vector, when normalized, should align with [0, 1, 0] T l Now let’s composite the results

Compositing Vectors to Form V l We know the three world axis vectors (x, y, z) l We know the three camera axis vectors (u, v, n) l Viewing transformation, V, must convert from world to camera coordinate systems

Compositing Vectors to Form V l Remember –Each camera axis vector is unit length. –Each camera axis vector is perpendicular to others l Camera matrix is orthogonal and normalized –Orthonormal l Therefore, M -1 = M T

Compositing Vectors to Form V l Therefore, rotation component of viewing transformation is just transpose of computed vectors

Compositing Vectors to Form V l Translation component too l Multiply it through

Final Viewing Transformation, V l To transform vertices, use this matrix: l And you get this:

Special Viewing Transformations l Orthographic is one alternative

Orthographic Transformation l Simple Orthographic Transformation l Original world units are preserved –Pixel units are preferred

Screen-space Transformation l left, right, top, bottom refer to the viewing frustum in modeling coordinates l width and height are in pixel units l This matrix scales and translates to accomplish the transition in units

Perspective Projections l First discovered by Donatello, Brunelleschi, and DaVinci during Renaissance l Objects closer to viewer look larger l Parallel lines appear to converge to single point

Perspective Projection l In the real world, objects exhibit perspective foreshortening: distant objects appear smaller l The basic situation:

Perspective Projection l When we do 3-D graphics, we think of the screen as a 2-D window onto the 3-D world: How tall should this bunny be?

Perspective Projection l The geometry of the situation is that of similar triangles. View from above: l What is y’? P (x, y, z) y Z View plane d (0,0,0) y’ = ?

Perspective Projection Desired result for a point [x, y, z, 1] T projected onto the view plane: l What could a matrix look like to do this?

A Perspective Projection Matrix l Answer:

A Perspective Projection Matrix l Example: l Or, in 3-D coordinates:

Screen-space Coordinates l Translate model units to pixel units

Canonical Perspective View Volume l Perspective view volume is shaped like a truncated pyramid l A canonical perspective view volumes scale a perspective view volume –Base has sides length 2 –Height is 1 –Origin is centered

Canonical Space Mapping for Perspective Projection