MIT EECS 6.837, Durand and Cutler Transformations.

Slides:



Advertisements
Similar presentations
Affine Transformations Jim Van Verth NVIDIA Corporation
Advertisements

Transformations in Ray Tracing MIT EECS 6.837, Durand and Cutler.
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Transformations Ed Angel Professor Emeritus of Computer Science
Computer Graphics Lecture 4 Geometry & Transformations.
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Transformations.
Geometric Transformations
3D Graphics Rendering and Terrain Modeling
MIT EECS 6.837, Durand and Cutler Transformations.
2-D Geometry. The Image Formation Pipeline Outline Vector, matrix basics 2-D point transformations Translation, scaling, rotation, shear Homogeneous.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
Announcements. Projection Today’s Readings Nalwa 2.1.
3-D Geometry.
Computer Vision : CISC4/689
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Lecture 3 – Transformation And Coordinate Systems
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Introduction to 3D Graphics Lecture 3: General Camera Model Anthony Steed University College London.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Mathematical Fundamentals
CS 431/636 Advanced Rendering Techniques Dr. David Breen University Crossings 149 Tuesday 6PM  8:50PM Presentation 2 4/7/09.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
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.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Geometric Transformations Jehee Lee Seoul National University.
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.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Geometric Objects and Transformation
CS654: Digital Image Analysis Lecture 6: Basic Transformations.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
1 Chapter 2: Geometric Camera Models Objective: Formulate the geometrical relationships between image and scene measurements Scene: a 3-D function, g(x,y,z)
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Image Warping 2D Geometric Transformations
Modeling Transformation
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
MIT EECS 6.837, Durand and Cutler Transformations & Local Illumination.
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Transforms.
3. Transformation
Computer Graphics CC416 Week 15 3D Graphics.
Review: Transformations
Review: Transformations
Lecture 2 Transformations
Transformations.
COMP 175: Computer Graphics February 9, 2016
Geometrical Transformations
Presentation transcript:

MIT EECS 6.837, Durand and Cutler Transformations

MIT EECS 6.837, Durand and Cutler Last Time? Ray representation Generating rays from eye point / camera –orthographic camera –perspective camera Find intersection point & surface normal Primitives: –spheres, planes, polygons, triangles, boxes

MIT EECS 6.837, Durand and Cutler Assignment 0 – main issues Respect specifications! Don’t put too much in the main function Use object-oriented design –Especially since you will have to build on this code Perform good memory management –Use new and delete Avoid unnecessary temporary variables Use enough precision for random numbers Sample a distribution using cumulative probability

MIT EECS 6.837, Durand and Cutler Outline Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler What is a Transformation? Maps points (x, y) in one coordinate system to points (x', y') in another coordinate system For example, IFS: x' = ax + by + c y' = dx + ey + f

MIT EECS 6.837, Durand and Cutler Simple Transformations Can be combined Are these operations invertible? Yes, except scale = 0

MIT EECS 6.837, Durand and Cutler Transformations are used: Position objects in a scene (modeling) Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations

MIT EECS 6.837, Durand and Cutler Outline Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler Rigid-Body / Euclidean Transforms Preserves distances Preserves angles Translation Rotation Rigid / Euclidean Identity

MIT EECS 6.837, Durand and Cutler Similitudes / Similarity Transforms Preserves angles Translation Rotation Rigid / Euclidean Similitudes Isotropic Scaling Identity

MIT EECS 6.837, Durand and Cutler Linear Transformations Translation Rotation Rigid / Euclidean Linear Similitudes Isotropic Scaling Identity Scaling Shear Reflection

MIT EECS 6.837, Durand and Cutler Linear Transformations L(p + q) = L(p) + L(q) L(ap) = a L(p) Translation Rotation Rigid / Euclidean Linear Similitudes Isotropic Scaling Scaling Shear Reflection Identity

MIT EECS 6.837, Durand and Cutler Affine Transformations preserves parallel lines Translation Rotation Rigid / Euclidean Linear Similitudes Isotropic Scaling Scaling Shear Reflection Identity Affine

MIT EECS 6.837, Durand and Cutler Projective Transformations preserves lines Translation Rotation Rigid / Euclidean Linear Affine Projective Similitudes Isotropic Scaling Scaling Shear Reflection Perspective Identity

MIT EECS 6.837, Durand and Cutler Perspective Projection

MIT EECS 6.837, Durand and Cutler General (free-form) transformation Does not preserve lines Not as pervasive, computationally more involved Won’t be treated in this course From Sederberg and Parry, Siggraph 1986

MIT EECS 6.837, Durand and Cutler Outline Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler How are Transforms Represented? x' = ax + by + c y' = dx + ey + f x' y' a b d e cfcf = xyxy + p' = M p + t

MIT EECS 6.837, Durand and Cutler 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' = xyzwxyzw aeimaeim bfjnbfjn cgkocgko dhlpdhlp p' = M p

MIT EECS 6.837, Durand and Cutler Translation in homogenous coordinates x' = ax + by + c y' = dx + ey + f x' y‘ 1 a b d e 0 cf1cf1 = xy1xy1 p' = M p x' y' a b d e cfcf = xyxy + p' = M p + t Affine formulationHomogeneous formulation

MIT EECS 6.837, Durand and Cutler Homogeneous Coordinates Most of the time w = 1, and we can ignore it If we multiply a homogeneous coordinate by an affine matrix, w is unchanged x' y' z' 1 = xyz1xyz1 aei0aei0 bfj0bfj0 cgk0cgk0 dhl1dhl1

MIT EECS 6.837, Durand and Cutler Homogeneous Visualization Divide by w to normalize (homogenize) W = 0? w = 1 w = 2 (0, 0, 1) = (0, 0, 2) = … (7, 1, 1) = (14, 2, 2) = … (4, 5, 1) = (8, 10, 2) = … Point at infinity (direction)

MIT EECS 6.837, Durand and Cutler Translate (t x, t y, t z ) Why bother with the extra dimension? Because now translations can be encoded in the matrix! x' y' z' 0 = xyz1xyz txtx tyty tztz 1 Translate(c,0,0) x y p p' c x' y' z' 1

MIT EECS 6.837, Durand and Cutler Scale (s x, s y, s z ) Isotropic (uniform) scaling: s x = s y = s z x' y' z' 1 = xyz1xyz1 sxsx sysy szsz Scale(s,s,s) x p p' q q' y

MIT EECS 6.837, Durand and Cutler Rotation About z axis x' y' z' 1 = xyz1xyz1 cos θ sin θ 0 0 -sin θ cos θ ZRotate(θ) x y z p p' θ

MIT EECS 6.837, Durand and Cutler Rotation About (k x, k y, k z ), a unit vector on an arbitrary axis (Rodrigues Formula) x' y' z' 1 = xyz1xyz1 k x k x (1-c)+c k y k x (1-c)+k z s k z k x (1-c)-k y s k z k x (1-c)-k z s k z k x (1-c)+c k z k x (1-c)-k x s 0 k x k z (1-c)+k y s k y k z (1-c)-k x s k z k z (1-c)+c 0 where c = cos θ & s = sin θ Rotate(k, θ) x y z θ k

MIT EECS 6.837, Durand and Cutler Storage Often, w is not stored (always 1) Needs careful handling of direction vs. point –Mathematically, the simplest is to encode directions with w=0 –In terms of storage, using a 3-component array for both direction and points is more efficient –Which requires to have special operation routines for points vs. directions

MIT EECS 6.837, Durand and Cutler Outline Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler How are transforms combined? (0,0) (1,1) (2,2) (0,0) (5,3) (3,1) Scale(2,2)Translate(3,1) TS = = Scale then Translate Use matrix multiplication: p' = T ( S p ) = TS p Caution: matrix multiplication is NOT commutative!

MIT EECS 6.837, Durand and Cutler Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p Translate then Scale: p' = S ( T p ) = ST p (0,0) (1,1) (4,2) (3,1) (8,4) (6,2) (0,0) (1,1) (2,2) (0,0) (5,3) (3,1) Scale(2,2)Translate(3,1) Scale(2,2)

MIT EECS 6.837, Durand and Cutler TS = ST = Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p = = Translate then Scale: p' = S ( T p ) = ST p

MIT EECS 6.837, Durand and Cutler Today Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler Transformations in Modeling Position objects in a scene Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations

MIT EECS 6.837, Durand and Cutler Scene Description Scene LightsCameraObjects Materials (much more next week) Background

MIT EECS 6.837, Durand and Cutler Simple Scene Description File OrthographicCamera { center direction up size 5 } Lights { numLights 1 DirectionalLight { direction color } } Background { color } Materials { numMaterials } Group { numObjects }

MIT EECS 6.837, Durand and Cutler Cylinder Group Plane Sphere Cone Triangle Class Hierarchy Object3D

MIT EECS 6.837, Durand and Cutler Why is a Group an Object3D? Logical organization of scene

MIT EECS 6.837, Durand and Cutler Ray-group intersection Recursive on all sub-objects

MIT EECS 6.837, Durand and Cutler Simple Example with Groups Group { numObjects 3 Group { numObjects 3 Box { } Box { } } Group { numObjects 2 Group { Box { } Box { } } Group { Box { } Sphere { } Sphere { } } } Plane { } }

MIT EECS 6.837, Durand and Cutler Adding Materials Group { numObjects 3 Material { } Group { numObjects 3 Box { } Box { } } Group { numObjects 2 Material { } Group { Box { } Box { } } Group { Material { } Box { } Material { } Sphere { } Material { } Sphere { } } } Material { } Plane { } }

MIT EECS 6.837, Durand and Cutler Adding Transformations

MIT EECS 6.837, Durand and Cutler Class Hierarchy with Transformations Object3D Cylinder Group Plane Sphere Cone Triangle Transform

MIT EECS 6.837, Durand and Cutler Why is a Transform an Object3D? To position the logical groupings of objects within the scene

MIT EECS 6.837, Durand and Cutler Simple Example with Transforms Group { numObjects 3 Transform { ZRotate { 45 } Group { numObjects 3 Box { } Box { } } } Transform { Translate { } Group { numObjects 2 Group { Box { } Box { } } Group { Box { } Sphere { } Sphere { } } } } Plane { } }

MIT EECS 6.837, Durand and Cutler Nested Transforms Transform { Translate { } Scale { } Sphere { center radius 1 } } Transform { Translate { } Transform { Scale { } Sphere { center radius 1 } } } p' = T ( S p ) = TS p same as Translate Scale Translate Scale Sphere