Preserving Normals Lecture 28 Wed, Nov 12, 2003. The Effect of a Transformation on a Normal What happens to a normal vector under a linear transformation?

Slides:



Advertisements
Similar presentations
1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
Advertisements

Transformations Ed Angel Professor Emeritus of Computer Science
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Invariants (continued).
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.
Geometric Transformations
Arbitrary Rotations in 3D Lecture 18 Wed, Oct 8, 2003.
CLASS 6 PERSPECTIVE CS770/870. Orthographic projections Isometric ObliqueIn isometric all distances along the major axes are the same.
Transformations II Week 2, Wed Jan 17
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
2-D Geometry. The Image Formation Pipeline Outline Vector, matrix basics 2-D point transformations Translation, scaling, rotation, shear Homogeneous.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
©College of Computer and Information Science, Northeastern UniversityJune 26, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 11.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Linear Least Squares QR Factorization. Systems of linear equations Problem to solve: M x = b Given M x = b : Is there a solution? Is the solution unique?
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
CS 450: Computer Graphics 2D TRANSFORMATIONS
Week 4 - Monday.  What did we talk about last time?  Vectors.
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
©College of Computer and Information Science, Northeastern UniversitySeptember 9, CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
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.
2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
The View Matrix Lecture 21 Fri, Oct 17, The View Matrix The function gluLookAt() creates a matrix representing the transformation from world coordinates.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
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
CS5500 Computer Graphics April 23, Today’s Topic Details of the front-end of the 3D pipeline: –How to construct the viewing matrix? –How to construct.
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Cornell CS465 Fall 2004 Lecture 9© 2004 Steve Marschner 1 3D Transformations CS 465 Lecture 9.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
Chapter 61 Chapter 7 Review of Matrix Methods Including: Eigen Vectors, Eigen Values, Principle Components, Singular Value Decomposition.
Transformations in 3D Lecture 17 Mon, Oct 6, 2003.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
COMPUTER GRAPHICS AND LINEAR ALGEBRA AN INTRODUCTION.
Computer Graphics Lecture 15 Fasih ur Rehman. Last Class Combining Transformations Affine versus Rigid body Transformations Homogenous Transformations.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Week 4 - Monday CS361.
3D Geometric Transformations
Introduction to Computer Graphics CS 445 / 645
Computer Graphics Transformations
COMP 175: Computer Graphics February 9, 2016
FP1 Matrices Transformations
Chapter IV Spaces and Transforms
Viewing and Perspective Transformations
Lecture 8: 3D Transforms Li Zhang Spring 2008
CS5500 Computer Graphics April 24, 2006.
Robotics 1 Copyright Martin P. Aalund, Ph.D.
Translation in Homogeneous Coordinates
Presentation transcript:

Preserving Normals Lecture 28 Wed, Nov 12, 2003

The Effect of a Transformation on a Normal What happens to a normal vector under a linear transformation? A translation? A rotation? A scaling? Other?

Rotations and Translations It seems intuitive that if u and v are orthogonal, then their images will be orthogonal under both translations and rotations, since these are rigid motions. v n v n

Rotations, Translations, and Scalings However, under scalings, their images will, in general, not be orthogonal. v n v n

Rotations, Translations, and Scalings Nor will they be orthogonal under a shear transformation. v n vn

The Effect on a Normal Let v be a vector lying in the tangent plane. Let n be a unit normal vector at that point. v n

The Effect on a Normal Then n  v = 0. Equivalently, if we regard n and v as 3  1 matrices, then n T v = 0, where n T is the transpose of n and the operation is matrix multiplication.

The Effect on a Normal Let M be a linear transformation. Then M maps v to v’ = Mv and M maps n to n’ = Mn. In general, v’ and n’ will not be orthogonal. That is because (n’) T v’ = (Mn) T (Mv) = (n T M T )(Mv) = n T (M T M)v  0. (?)

Transforming a Normal So if Mn is not orthogonal to v’, then what vector will be orthogonal to v’? Let’s try n’’ = (M -1 ) T n. Then n’’ T v’ is (n’’) T v’ = ((M -1 ) T n) T (Mv) = (n T M -1 )(Mv) = n T (M -1 M)v = n T v = 0.

Transforming a Normal This demonstrates that if the surface points are transformed by matrix M, then the surface normals should be transformed by the matrix (M -1 ) T, the transpose of the inverse, in order to remain normal to the surface.

The Case of Translations The case of translations is very simple since the matrix does not change the normal vector in the first place. 100dx 010dy 001dz 0001 vxvx vyvy vzvz 0 vxvx vyvy vzvz 0 =

The Case of Translations In the case of translations, we know that Mn = n and Mv = v. It follows that Mn and Mv are orthogonal since (Mn) T (Mv) = n T v = 0.

The Case of Rotations In the case of rotations, the transpose of the inverse of the matrix is the same matrix again! (I.e., M -1 = M T.) Such a matrix is said to be orthonormal. Therefore, (Mn) T (Mv) = (n T M T )Mv = n T (M T M)v = n T (I)v = n T v = 0.

Scalings Let M be the matrix of the scaling Scale(s x, s y, s z ). Then sxsx 00 0sysy 0 00szsz M = 1/s x 00 01/s y 0 001/s z (M -1 ) T =

Scalings Under the scaling Scale(s x, s y, s z ), the point P = (x, y, z) is transformed into the point P’ = MP = (s x x, s y y, s z z). But the normal vector n = (n x, n y, n z ) must be transformed into the normal vector n’ = (M -1 ) T n = (n x /s x, n y /s y, n z /s z ).

Other Transformations For other transformations, we must apply the transpose of the inverse matrix to the normal vectors to produce normals to the transformed surface.

Consequences for Programming OpenGL applies transformation matrices to both the vertices but it applies the transpose of the inverse to the normals. One consequence is that, if we compute the transformed normals ourselves, then we must be sure to apply the transpose of the inverse and renormalize.

Consequences for Programming However, In translations, it is not necessary to do anything. In rotations, we may apply the very same matrix.

Renormalizing Vectors in OpenGL Luckily, OpenGL will automatically recalculate normals if we ask it to. We should write the statement glEnable(GL_NORMALIZE); This statement forces OpenGL to renormalize all surface normals after transformations, throughout the program.

Caution This function call is expensive since unit normals have already been computed and now they must be recomputed. It should be used only if the transformations include scalings or non- standard transformations. It would be more efficient to compute the correct normals from the start, if the situation allows for that.

Example: Scaling in the Mesh Class NormScaler.cpp mesh2.cpp vector3.cpp