Advanced Computer Graphics Transformations. Matthias Teschner

Similar documents
Linear and Affine Transformations Coordinate Systems

Computer Graphics Ray Casting. Matthias Teschner

Transformations Week 9, Lecture 18

Visual Recognition: Image Formation

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

calibrated coordinates Linear transformation pixel coordinates

Computer Graphics: Geometric Transformations

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CHAPTER 1 Graphics Systems and Models 3

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

GEOMETRIC TRANSFORMATIONS AND VIEWING

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

Multiple View Geometry in Computer Vision

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Computer Graphics Curves and Surfaces. Matthias Teschner

Specifying Complex Scenes

CSE328 Fundamentals of Computer Graphics

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 253

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review.

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 263

Transforms. COMP 575/770 Spring 2013

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

Geometric Transformations

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Models and The Viewing Pipeline. Jian Huang CS456

Graphics Pipeline 2D Geometric Transformations

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Overview. By end of the week:

Last week. Machiraju/Zhang/Möller/Fuhrmann

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Transforms 1 Christian Miller CS Fall 2011

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Rasterization Overview

2D/3D Geometric Transformations and Scene Graphs

CS451Real-time Rendering Pipeline

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

Transformations in Ray Tracing. MIT EECS 6.837, Durand and Cutler

Computer Graphics Shadow Algorithms

2D transformations: An introduction to the maths behind computer graphics

UNIT 2 2D TRANSFORMATIONS

IMAGE-BASED RENDERING AND ANIMATION

Overview. Affine Transformations (2D and 3D) Coordinate System Transformations Vectors Rays and Intersections

Vector Algebra Transformations. Lecture 4

3.3 Interpolation of rotations represented by quaternions

Intersection Acceleration

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Three Main Themes of Computer Graphics

CT5510: Computer Graphics. Transformation BOCHANG MOON

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Part II: OUTLINE. Visualizing Quaternions. Part II: Visualizing Quaternion Geometry. The Spherical Projection Trick: Visualizing unit vectors.

3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Multiple View Geometry in Computer Vision

Quaternions and Rotations

3-D D Euclidean Space - Vectors

Quaternions and Rotations

Viewing. Reading: Angel Ch.5

Computer Graphics I Lecture 11

3D Viewing. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

Lecture 5 2D Transformation

CS 4620 Midterm 1. Tuesday 22 October minutes

Camera Calibration. COS 429 Princeton University

COMP3421. Vector geometry, Clipping

12.1 Quaternions and Rotations

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

55:148 Digital Image Processing Chapter 11 3D Vision, Geometry

Stereo Vision. MAN-522 Computer Vision

Object Representation Affine Transforms. Polygonal Representation. Polygonal Representation. Polygonal Representation of Objects

Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Quaternions and Rotations

Structure from motion

Camera model and multiple view geometry

Camera Model and Calibration

Affine Transformations in 3D

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

Camera Calibration. Schedule. Jesus J Caban. Note: You have until next Monday to let me know. ! Today:! Camera calibration

Quaternions and Rotations

THE VIEWING TRANSFORMATION

2D Image Transforms Computer Vision (Kris Kitani) Carnegie Mellon University

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Implementing a virtual camera. Graphics 2. Creating a view of the scene an outline. Virtual camera - definitions

3D Geometry and Camera Calibration

Matrix Operations with Applications in Computer Graphics

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Computer Graphics Geometric Transformations

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Animation. CS 4620 Lecture 33. Cornell CS4620 Fall Kavita Bala

Transcription:

Advanced Computer Graphics Transformations Matthias Teschner

Motivation Transformations are used To convert between arbitrary spaces, e.g. world space and other spaces, such as object space, camera space To position and animate objects, lights, and the virtual camera Transformations are applied to points, normals, rays University of Freiburg Computer Science Department 2

Outline Coordinate spaces Homogeneous coordinates Transformations Transformations in ray tracing Animating transformations University of Freiburg Computer Science Department 3

Coordinate Spaces Object space Space in which geometric primitives are defined Object spaces are object-dependent World space Objects, lights are placed / transformed into world space Object-to-world transformations allow to arbitrarily place objects and lights relative to each other University of Freiburg Computer Science Department 4

Coordinate Spaces Camera space Space with a specific camera setting, e.g. camera at the origin, viewing along z-axis, y-axis is up direction Useful for simplified computations (similar to the rendering pipeline) Camera is placed in world space with a view transformation Inverse view transform converts from world to camera space University of Freiburg Computer Science Department 5

From Object to Camera Space Inverse M 1 M 3 M 2 V -1 V M 4 [Akenine-Moeller et al.: Real-time Rendering] M 1, M 2, M 3, M 4, V are transformation matrices M 1, M 2, M 3, M 4 are object-to-world transforms placing objects in the scene V places and orientates the camera in space V -1 transforms the camera to the origin looking along the z-axis V -1 M 1..4 transforms all objects or lights from object to camera space University of Freiburg Computer Science Department 6

Outline Coordinate spaces Homogeneous coordinates Transformations Transformations in ray tracing Animating transformations University of Freiburg Computer Science Department 8

Motivation Using homogeneous coordinates, Affine transformations can be represented with a matrix Points, vectors, rays can be transformed in a unified way with one matrix-vector multiplication University of Freiburg Computer Science Department 9

Affine Transformations Affine transformations of a 3D point p: Affine transformations preserve affine combinations for E.g., a line can be transformed by transforming its control points University of Freiburg Computer Science Department 10

Points, Vectors, Rays Points specify a location (x, y, z) in space E.g., vertices of a triangulated object Vectors specify a direction (x, y, z) E.g., surface normals Rays A half-line specified by origin / position o and direction d Parametric form with Various additional properties in ray tracers, e.g. Parametric range, time, recursion depth University of Freiburg Computer Science Department 11

Homogeneous Coordinates of Points with w 0 are the homogeneous coordinates of the 3D point Examples (2, 3, 4, 1) (2, 3, 4) (2, 4, 6, 1) (2, 4, 6) (4, 8, 12, 2) (2, 4, 6) represents the same point for all with 0 University of Freiburg Computer Science Department 12

Homogeneous Coordinates of Vectors For varying w, a point is scaled and the points represent a line in 3D space The direction of this line is characterized by For w 0, the point moves to infinity in the direction is a point at infinity in the direction of is a vector in the direction of University of Freiburg Computer Science Department 13

Homogeneous Representation of Transformations Linear transformation Affine transformation Representing rotation, scale, shear, translation Projective components p are zero for affine transformations University of Freiburg Computer Science Department 14

Outline Coordinate spaces Homogeneous coordinates Transformations Transformations in ray tracing Animating transformations University of Freiburg Computer Science Department 15

Translation Point Vector Inverse (T -1 "undoes" the transform T) University of Freiburg Computer Science Department 16

Rotation Positive (anticlockwise) rotation with angle around the x-, y-, z-axis University of Freiburg Computer Science Department 17

Inverse Rotation The inverse of a rotation matrix corresponds to its transpose University of Freiburg Computer Science Department 18

Compositing Transformations Composition is achieved by matrix multiplication Note that generally The inverse is Examples Rotation about an arbitrary axes Scaling with respect to arbitrary directions Object-to-view space transformation University of Freiburg Computer Science Department 19

Outline Coordinate spaces Homogeneous coordinates Transformations Transformations in ray tracing Animating transformations University of Freiburg Computer Science Department 20

Objects Transformations can be represented in a graph or hierarchy, e.g., for a car T1 is applied to "chassis", T1 T2 T1 T5 are applied to the wheels University of Freiburg Computer Science Department 21

Instancing To save memory University of Freiburg Computer Science Department 22

Planes and Normals Planes can be represented by a surface normal n and a point r. All points p with form a plane. The transformed points represented by If a surface is transformed by A, its normal is transformed by (A -1 ) T University of Freiburg Computer Science Department 23 are on the plane

Normals Normals generally point outside of a surface If a transformation changes the handedness of the coordinate system, the normal n might need to be flipped to -n The handedness changes if the determinant is negative E.g., for a reflection R, University of Freiburg Computer Science Department 24

Rays For ray-object intersections, Objects are commonly not transformed Instead, rays are transformed with the inverse of the object-to-camera space transformation Algorithm Apply the inverse transform to the ray Compute intersection and normal Transform the intersection and the normal University of Freiburg Computer Science Department 25

Rays If computed in camera space, o is (0,0,0,1) T [Suffern: Ray Tracing] University of Freiburg Computer Science Department 26

Outline Coordinate spaces Homogeneous coordinates Transformations Transformations in ray tracing Animating transformations University of Freiburg Computer Science Department 27

Animating Transformations Keyframe matrix animation For camera and objects Defined by a number of keyframe transformations Allows camera / object movements, e.g. for motion blur Challenge Linear combination of two corresponding matrix values does not provide useful results for general transformations University of Freiburg Computer Science Department 28

Animating Translation, Scale, and Shear Linear interpolation of matrices, representing translation, is meaningful T( ) is a translation Interpolation of components also works for scale and shear University of Freiburg Computer Science Department 29

Animating Rotations Linear combination of matrix values does not work Interpolated matrix is not orthogonal, i.e. object can be distorted Determinant of the interpolated matrix is not one, lengths are not preserved, object can be stretched, compressed or degenerate to a line or a point University of Freiburg Computer Science Department 30 [Shoemake, Duff]

Animating Rotations A useful approach Convert the rotation matrices to a quaternion representation Perform a spherical linear interpolation (slerp) Convert the interpolated quaternion to a rotation matrix Motivation Rate of change of the rotation / orientation can be linear in the interpolation parameter when using quaternions University of Freiburg Computer Science Department 31

Quaternions Are four-tuples with Quaternion multiplication and Unit quaternions represent rotations (u is a unit vector) If v is a 3D vector, the product results in a vector v' rotated by around u q n is a rotation by n times the angle around u University of Freiburg Computer Science Department 32

Spherical Linear Interpolation Slerp(q 1, q 2, t) computes intermediate orientations between q 1 and q 2 Orientation changes are linear in t [Shoemake] Still leads to discontinuous orientation changes in case of changing rotation axes between key frames University of Freiburg Computer Science Department 33

Matrix Decomposition If keyframe transformations are composed of translation, rotation, and scale, the components have to be decomposed and interpolated independently Projective components are not considered, (but could be extracted easily) Translation can be extracted as University of Freiburg Computer Science Department 34

Rotation Extraction Approaches QR decomposition, SVD Polar decomposition Polar decomposition Efficient to compute Extracts rotation R that is closest to the original transf. M Find R minimizing subject to with being the Frobenius matrix norm -I in case of a negative determinant S is symmetric, positive definite (scale in a potentially rotated frame) shear cannot be extracted University of Freiburg Computer Science Department 35

Polar Decomposition Iterative computation [Higham] Until University of Freiburg Computer Science Department 36

Summary Coordinate spaces (object, world, camera) Homogeneous coordinates Points, vectors, rays can be transformed in a unified way Matrices for affine transformations and perspective projections Transformations Translation, rotation, scale, shear, inverse, composition Transformations in ray tracing (instancing, normals, rays) Animating transformations Polar decomposition, quaternions, linear and spherical linear interpolation University of Freiburg Computer Science Department 37