Lecture 3 – Transformation And Coordinate Systems

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Computer Graphics Lecture 4 Geometry & Transformations.
Transformations.
Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
MIT EECS 6.837, Durand and Cutler Transformations.
Camera Models A camera is a mapping between the 3D world and a 2D image The principal camera of interest is central projection.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
CS485/685 Computer Vision Prof. George Bebis
3-D Geometry.
The Pinhole Camera Model
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
COMP 175: Computer Graphics March 24, 2015
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.
Transformations Dr. Amy Zhang.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
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.
Geometric Transformations
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
MIT EECS 6.837, Durand and Cutler Transformations.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Games Development 1 Camera Projection / Picking CO3301 Week 8.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
CS559: Computer Graphics Lecture 8: 3D Transforms Li Zhang Spring 2008 Most Slides from Stephen Chenney.
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.
Mark Nelson 3d projections Fall 2013
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)
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Three-Dimensional Viewing Hearn & Baker Chapter 7
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.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Affine Geometry.
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.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Modeling and The Viewing Pipeline Jian Huang CS594 The material in this set of slides have referenced slides from Ohio State, Minnesota and MIT.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Modeling Transformation
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Rendering Pipeline Fall, 2015.
Geometric Transformations
CSCE 441 Computer Graphics 3-D Viewing
3D Transformations Source & Courtesy: University of Wisconsin,
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.
Transformations.
Three Dimensional Viewing
The Pinhole Camera Model
Presentation transcript:

Lecture 3 – Transformation And Coordinate Systems Computer Graphics CS630 Lecture 3 – Transformation And Coordinate Systems

What is a Transformation? Maps points (x, y) in one coordinate system to points (x', y') in another coordinate system x' = ax + by + c y' = dx + ey + f

Transformations Simple transformation Translation Rotation Scaling

Transformations Deformable transformations Issues Shearing Tapering Twisting Etc.. Issues Can be combined Are these operations invertible?

Transformations Why use transformations? Position objects in a scene (modeling) Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations

Classes of Transformation Rigid-Body/ Euclidean transformation Similarity Transforms Linear Transforms Affine Transforms Projective Transforms

Rigid-Body / Euclidean Transforms Preserves distances Preserves angles Rigid / Euclidean Identity Translation Rotation

How are Transforms Represented? x' = ax + by + c y' = dx + ey + f x' y' a b d e x y c f = + p' = M p + t

Translation = + = +

Properties of Translation = = = =

Scaling Uniform scaling iff

Rotations (2D)

Rotations 2D So in matrix notation

Rotations (3D)

Properties of Rotations order matters!

Combining Translation & Rotation

Combining Translation & Rotation

Homogeneous Coordinates Add an extra dimension in 2D, we use 3 x 3 matrices In 3D, we use 4 x 4 matrices Each point has an extra value, w x' y' z' w' a e i m b f j n c g k o d h l p x y z w = p' = M p

Homogeneous Coordinates Most of the time w = 1, and we can ignore it x' y' z' 1 a e i b f j c g k d h l 1 x y z 1 =

Homogeneous Coordinates can be represented as where

Translation Revisited

Rotation & Scaling Revisited

Combining Transformations where

Transforming Tangents

Transforming Normals

Surface Normal Surface Normal: unit vector that is locally perpendicular to the surface

Why is the Normal important? It's used for shading — makes things look 3D! object color only Diffuse Shading

Visualization of Surface Normal ± x = Red ± y = Green ± z = Blue

How do we transform normals? nWS nOS World Space Object Space

Transform the Normal like the Ray? translation? rotation? isotropic scale? scale? reflection? shear? perspective?

More Normal Visualizations Incorrect Normal Transformation Correct Normal Transformation

Transforming Normals

Rotations about an arbitrary axis Rotate by around a unit axis

An Alternative View We can view the rotation around an arbitrary axis as a set of simpler steps We know how to rotate and translate around the world coordinate system Can we use this knowledge to perform the rotation?

Rotation about an arbitrary axis Translate the space so that the origin of the unit vector is on the world origin Rotate such that the extremity of the vector now lies in the xz plane (x-axis rotation) Rotate such that the point lies in the z-axis (y-axis rotation) Perform the rotation around the z-axis Undo the previous transformations

Rotation about an arbitrary axis Step 1 Rotate x-axis y (a,b,c) x x (a’,b’,c’) z

Closer Look at Y-Z Plane Need to rotate  degrees around the x-axis y  z

Equations for 

Rotation about the Y-axis Using the same analysis as before, we need to rotate  degrees around the Y-axis y x (a’,b’,c’)=Rx () (a,b,c)T z

Equations for 

Rotation about the Z-axis Now, it is aligned with the Z-axis, thus we can simply rotate  degrees around the Z-axis. Then undo all the transformations we just did

Equation summary

Deformations Transformations that do not preserve shape Non-uniform scaling Shearing Tapering Twisting Bending

Shearing

Tapering

Twisting

Bending

Quick Recap Computer Graphics is using a computer to generate an image from a representation. computer Model Image

Modeling What we have been studying so far is the mathematics behind the creation and manipulation of the 3D representation of the object. computer Model Image

What have we seen so far? Basic representations (point, vector) Basic operations on points and vectors (dot product, cross products, etc.) Transformation – manipulative operators on the basic representation (translate, rotate, deformations) – 4x4 matrices to “encode” all these.

Why do we need this? In order to generate a picture from a model, we need to be able to not only specify a model (representation) but also manipulate the model in order to create more interesting images.

Overview The next set of slides will deal with the other half of the process. From a model, how do we generate an image computer Model Image

Scene Description Scene Camera Lights Background Materials Objects

Graphics Pipeline

Graphics Pipeline Modeling transforms orient the models within a common coordinate frame (world space)

Graphics Pipeline

Graphics Pipeline Maps world space to eye space Viewing position is transformed to origin & direction is oriented along some axis (usually z)

Graphics Pipeline Transform to Normalized Device Coordinates (NDC) Portions of the object outside the view volume (view frustum) are removed

Graphics Pipeline The objects are projected to the 2D image place (screen space)

Graphics Pipeline

Graphics Pipeline Z-buffer - Each pixel remembers the closest object (depth buffer)

Graphics Pipeline Almost every step in the graphics pipeline involves a change of coordinate system. Transformations are central to understanding 3D computer graphics.

Intuitively World Object Space Space Camera Space +Projection +NDC Rasterization

Coordinate Systems Object coordinates World coordinates Camera coordinates Normalized device coordinates Window coordinates

Object Coordinates Convenient place to model the object

World Coordinates Common coordinates for the scene

Positioning Synthetic Camera What are our “degrees of freedom” in camera positioning? To achieve effective visual simulation, we want: 1) the eye point to be in proximity of modeled scene 2) the view to be directed toward region of interest, and 3) the image plane to have a reasonable “twist”

Eye Coordinates Eyepoint at origin u axis toward “right” of image plane v axis toward “top” of image plane view direction along negative n axis

Transformation to Eye Coordinates Our task: construct the transformation M that re-expresses world coordinates in the viewer frame

Machinery: Changing Orthobases Suppose you are given an orthobasis u, v, n What is the action of the matrix M with rows u, v, and n as below?

Applying M to u, v, n Two equally valid interpretations, depending on reference frame: 1: Think of uvn basis as a rigid object in a fixed world space Then M “rotates” uvn basis into xyz basis 2: Think of a fixed axis triad, with “labels” from xyz space Then M “reexpresses” an xyz point p in uvn coords! It is this second interpretation that we use today to “relabel” world-space geometry with eye space coordinates

Positioning Synthetic Camera Given eyepoint e, basis ˆu, ˆv, ˆn Deduce M that expresses world in eye coordinates: Overlay origins, then change bases:

Positioning Synthetic Camera Check: does M re-express world geometry in eye coordinates?

Positioning Synthetic Camera Camera specification must include: World-space eye position e World-space “lookat direction” -n Are e and -n enough to determine the camera DOFs (degrees of freedom)?

Positioning Synthetic Camera Are e and -n enough to determine the camera DOFs? No. Note that we were not given u and v! (Why not simply require the user to specify them?) We must also determine u and v, i.e., camera “twist” about n. Typically done by specification of a world-space “up vector” provided by user interface, e.g., using gluLookat(e, c, up) “Twist” constraint: Align v with world up vector (How?)

Positioning Synthetic Camera

Where are we?

What is Projection? Any operation that reduces dimension (e.g., 3D to 2D) Orthographic Projection Perspective Projection

Orthographic Projection focal point at infinity rays are parallel and orthogonal to the image plane F Image World I W Image World F

Comparison

Simple Perspective Camera camera looks along z-axis focal point is the origin image plane is parallel to xy-plane at distance d d is call focal length

Similar Triangles Similar situation with x-coordinate Y Z [0, d] [0, 0] [Y, Z] [(d/Z)Y, d] Similar situation with x-coordinate Similar Triangles: point [x,y,z] projects to [(d/z)x, (d/z)y, d]

Divide by 4th coordinate Projection Matrix Projection using homogeneous coordinates: transform [x, y, z] to [(d/z)x, (d/z)y, d] d 1 é ë ê ù û ú x y z = dx dy dz [ ] Þ Divide by 4th coordinate (the “w” coordinate) 2-D image point: discard third coordinate apply viewport transformation to obtain physical pixel coordinates

Perspective Projection

Perspective Projection z = 0 not allowed (what happens to points on plane z = 0?) Operation well-defined for all other points

Perspective Projection Matrix formulation using “homogeneous 4-vectors”: Finally, recover projected point using homogenous convention: Divide by 4th element to convert 4-vector to 3-vector:

Camera Coordinates Coordinate system with the camera in a convenient pose y x z

View Volume and Normalized Device Coordinates

Normalized Device Coordinates Device independent coordinates Visible coordinate usually range from:

Perspective Projection Taking the camera coordinates to NDC

Perspective Projection

Perspective Projection + NDC

Window Coordinates Adjusting the NDC to fit the window is the lower left of the window

Window Coordinates Adjusting the NDC to fit the window is the lower left of the window height width

Window Coordinates

Summary : Object Coordinate to Device Coordinate Take your representation (points) and transform it from Object Space to World Space (Mwo) Take your World Space point and transform it to Camera Space (Mcw) Perform the remapping and projection onto the image plane in Normalized Device Coordinates (Mw_p Mpc) Perform this set of transformations on each point of the polygonal object (M= Mw_pMpcMcwMwo)