CSCE 689: Computer Animation Rotation Representation and Interpolation

Slides:



Advertisements
Similar presentations
John C. Hart CS 318 Interactive Computer Graphics
Advertisements

Three Dimensional Modeling Transformations
CS B659: Principles of Intelligent Robot Motion Rigid Transformations.
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
3D Kinematics Eric Whitman 1/24/2010. Rigid Body State: 2D p.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Orientation & Quaternions
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D Coordinate Systems and Transformations Revision 1
Outline for Today More math… Finish linear algebra: Matrix composition
3-D Geometry.
3D orientation.
CSCE 441: Computer Graphics Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Rotation representation and Interpolation
Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background.
CS 445 / 645 Introduction to Computer Graphics Lecture 21 Representing Rotations Lecture 21 Representing Rotations.
CS I400/B659: Intelligent Robotics Rigid Transformations.
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Vision Group Prof. Daniel Cremers Autonomous Navigation for Flying Robots Lecture 3.1: 3D Geometry Jürgen Sturm Technische Universität München.
1 Kinematics ( 運動學 ) Primer Jyun-Ming Chen Fall 2009.
Visualizing Orientation using Quaternions Gideon Ariel; Rudolf Buijs; Ann Penny; Sun Chung.
Mathematical Fundamentals
Rotations and Translations
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)
CS 450: COMPUTER GRAPHICS QUATERNIONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics Bing-Yu Chen National Taiwan University.
Rotations and Translations
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Rick Parent - CIS681 ORIENTATION Use Quaternions Interpolating rotations is difficult.
Maths and Technologies for Games Quaternions CO3303 Week 1.
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
Advanced Computer Graphics Spring 2014
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Rotations and Quaternions Week 9, Wed 29 Oct 2003.
3D Kinematics Consists of two parts
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
Rotation and Orientation: Fundamentals Jehee Lee Seoul National University.
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 17, 2015 TRANSFORMATIONS AFFINE TRANSFORMATIONS QUATERNIONS.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Affine Geometry.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Advanced Math.
Fundamentals of Computer Animation Orientation and Rotation.
REFERENCE: QUATERNIONS/ Ogre Transformations.
Computer Animation Algorithms and Techniques
Review: 3D Transforms Continued
CPSC 641: Computer Graphics Rotation Representation and Interpolation
CS 445 / 645 Introduction to Computer Graphics
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Computer Graphics Transformations.
Rotation representation and Interpolation
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
UMBC Graphics for Games
Geometric Objects and Transformations (II)
CSCE441: Computer Graphics 2D/3D Transformations
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN
Rotation and Orientation: Fundamentals
Presentation transcript:

CSCE 689: Computer Animation Rotation Representation and Interpolation Jinxiang Chai

Joints and Rotation Rotational dofs are widely used in character animation 3 translation dofs 48 rotational dofs 1 dof: knee 2 dof: wrist 3 dof: shoulder

Orientation vs. Rotation Orientation is described relative to some reference alignment A rotation changes object from one orientation to another Can represent orientation as a rotation from the reference alignment 

Ideal Orientation Format Represent 3 degrees of freedom with minimum number of values Allow concatenations of rotations Math should be simple and efficient concatenation interpolation rotation

Outline Rotation matrix Fixed angle and Euler angle Axis angle Quaternion

3D Transformation A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent points Homogeneous coordinates of a 3D point (x,y,z,1)T Transformation will be performed using 4x4 matrix

Right-handed Coordinate System Left hand coordinate system Not used in this class and Not in OpenGL

Homogenous coordinates 3D Transformation Very similar to 2D transformation Translation transformation Homogenous coordinates

Homogenous coordinates 3D Transformation Very similar to 2D transformation Scaling transformation Homogenous coordinates

3D Rotation 3D rotation is done around a rotation axis Fundamental rotations – rotate about x, y, or z axes Counter-clockwise rotation is referred to as positive rotation (when you look down negative axis) y + x z

3D Rotation Rotation about z – similar to 2D rotation y + x z

3D Rotation Rotation about y: z -> y, y -> x, x->z z y x y x

3D Rotation Rotation about x (z -> x, y -> z, x->y) x z y y x Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters, y x z

3D Rotation An arbitrary rotation can be defined by a matrix y x z

Matrices as Orientation Matrices just fine, right? No… 9 values to interpolate don’t interpolate well

Representation of orientation Homogeneous coordinates (review): 4X4 matrix used to represent translation, scaling, and rotation a point in the space is represented as Treat all transformations the same so that they can be easily combined

Rotation New points rotation matrix old points

Interpolation In order to “move things”, we need both translation and rotation Interpolating the translation is easy, but what about rotations?

Interpolation of Orientation How about interpolating each entry of the rotation matrix? The interpolated matrix might no longer be orthonormal, leading to nonsense for the inbetween rotations

Interpolation of Orientation Example: interpolate linearly from a positive 90 degree rotation about y axis to a negative 90 degree rotation about y Linearly interpolate each component and halfway between, you get this... Rotate about y-axis with 90 Rotate about y-axis with -90

Properties of Rotation Matrix Easily composed? Interpolation? Compact representation?

Properties of Rotation Matrix Easily composed? yes Interpolation? Compact representation?

Properties of Rotation Matrix Easily composed? yes Interpolation? not good Compact representation?

Properties of Rotation Matrix Easily composed? yes Interpolation? not good Compact representation? - 9 parameters (only needs 3 parameters)

Outline Rotation matrix Fixed angle and Euler angle Axis angle Quaternion

Fixed Angles Angles used to rotate about fixed axes Orientations are specified by a set of 3 ordered parameters that represent 3 ordered rotations about fixed axes Many possible orderings: x-y-z, x-y-x,y-x-z - as long as axis does immediately follow itself such as x-x-y

Fixed Angles Ordered triple of rotations about global axes, any triple can be used that doesn’t immediately repeat an axis, e.g., x-y-z, is fine, so is x-y-x. But x-x-z is not. X Z Y E.g., (qz, qy, qx) Q = Rx(qx). Ry(qy). Rz(qz). P

Euler Angles vs. Fixed Angles One point of clarification Euler angle - rotates around local axes Fixed angle - rotates around world axes Rotations are reversed - x-y-z Euler angles == z-y-x fixed angles

Euler Angle Interpolation Interpolating each components separately Might have singularity problem Halfway between (0, 90, 0) & (90, 45, 90) Interpolate directly, get (45, 67.5, 45) Desired result is (90, 22.5, 90) (verify this!)

Euler Angle Concatenation Can't just add or multiply components Best way: Convert to matrices Multiply matrices Extract Euler angles from resulting matrix Not cheap

Gimbal Lock Euler/fixed angles not well-formed Different values can give same rotation Example with z-y-x fixed angles: ( -90, 90, 90 ) = ( 0, 90, 0 )

Gimbal Lock Euler/fixed angles not well-formed Different values can give same rotation Example with z-y-x fixed angles: ( -90, 90, 90 ) = ( 0, 90, 0 ) z y x

Gimbal Lock Euler/fixed angles not well-formed Different values can give same rotation Example with z-y-x fixed angles: ( -90, 90, 90 ) = ( 0, 90, 0 ) z y x z (-90,0,0) x y

Gimbal Lock Euler/fixed angles not well-formed Different values can give same rotation Example with z-y-x fixed angles: ( -90, 90, 90 ) = ( 0, 90, 0 ) z y x z (-90,0,0) (-90,90,0) x x y z y

Gimbal Lock Euler/fixed angles not well-formed Different values can give same rotation Example with z-y-x fixed angles: ( -90, 90, 90 ) = ( 0, 90, 0 ) z y x z (-90,0,0) (-90,90,0) (-90,90,90) y x x y z z y x

Gimbal Lock A Gimbal is a hardware implementation of Euler angles used for mounting gyroscopes or expensive globes Gimbal lock is a basic problem with representing 3D rotation using Euler angles or fixed angles

Gimbal Lock When two rotational axis of an object pointing in the same direction, the rotation ends up losing one degree of freedom

Outline Rotation matrix Fixed angle and Euler angle Axis angle Quaternion

Axis Angle Rotate object by q around A (Ax,Ay,Az,q) A Y q Z X The axis is really only 2 DoFs - its length is irrelevant Z X Euler’s rotation theorem: An arbitrary rotation may be described by only three parameters.

Axis-angle Rotation Given r – Vector in space to rotate n – Unit-length axis in space about which to rotate q – The amount about n to rotate Solve r’ – The rotated vector r’ r n

Axis-angle Rotation Compute rpar: the projection of r along the n direction rpar = (n·r)n r’ rpar r

Axis-angle Rotation Compute rperp: rperp = r-rpar rperp rpar r’ r

Axis-angle Rotation Compute v: a vector perpedicular to rpar and rperp: v= rparxrperp v rperp rpar r’ r

Axis-angle Rotation Compute v: a vector perpedicular to rpar and rperp: v= rparxrperp v rperp rpar r’ Use rpar, rperp and v, θ to compute the new vector! r

Axis-angle Rotation rperp = r – (n·r) n q V = n x (r – (n·r) n) = n x r r’ rpar = (n·r) n r n r’ = r’par + r’perp = r’par + (cos q) rperp + (sin q) V =(n·r) n + cos q(r – (n·r)n) + (sin q) n x r = (cos q)r + (1 – cos q) n (n·r) + (sin q) n x r

Axis-angle Rotation Can interpolate rotation well

Axis-angle Interpolation 1. Interpolate axis from A1 to A2 Rotate axis about A1 x A2 to get A A1 q1 A Y q A2 A1 x A2 2. Interpolate angle from q1 to q2 to get q q2 Z X 3. Rotate the object by q around A

Axis-angle Rotation Can interpolate rotation well Compact representation Messy to concatenate - might need to convert to matrix form

Outline Rotation matrix Fixed angle and Euler angle Axis angle Quaternion

Quaternion Remember complex numbers: a+ib, where i2=-1 Quaternions are a non-commutative extension of complex numbers Invented by Sir William Hamilton (1843) Quaternion: - Q = a + bi + cj + dk: where i2=j2=k2=ijk=-1,ij=k,jk=i,ki=j - Represented as: q = (w, v) = w + xi + yj + zk

Quaternion 4 tuple of real numbers: w, x, y, z Same information as axis angles but in a more computational-friendly form

Quaternion Math Unit quaternion Multiplication Non-commutative Associative

Quaternion Math Conjugate Inverse

Quaternion Example let then

Quaternion Rotation

Quaternion Rotation

Quaternion Example Rotate a point (1,0,0) about y-axis with -90 degrees z (0,0,1) y x (1,0,0)

Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees z (0,0,1) y x (1,0,0)

Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees z (0,0,1) y x (1,0,0) Point (1,0,0)

Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees z (0,0,1) y x (1,0,0) Point (1,0,0) Quaternion rotation

Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees z (0,0,1) y x (1,0,0)

Quaternion Composition Rotation by p then q is the same as rotation by qp

Matrix Form For a 3D point (x,y,z)

Quaternion Interpolation 1-angle rotation can be represented by a unit circle

Quaternion Interpolation 1-angle rotation can be represented by a unit circle 2-angle rotation can be represented by a unit sphere

Quaternion Interpolation 1-angle rotation can be represented by a unit circle 2-angle rotation can be represented by a unit sphere Interpolation means moving on n-D sphere Now imagine a 4-D sphere for 3-angle rotation

Quaternion Interpolation Moving between two points on the 4D unit Sphere: • a unit quaternion at each step - another point on the 4D unit sphere • move with constant angular velocity along the great circle between the two points on the 4D unit sphere

Quaternion Interpolation Direct linear interpolation does not work Linearly interpolated intermediate points are not uniformly spaced when projected onto the circle

Quaternion Interpolation Spherical linear interpolation (SLERP) Normalize to regain unit quaternion

Quaternion Interpolation Spherical linear interpolation (SLERP) Normalize to regain unit quaternion

Quaternion Interpolation Spherical linear interpolation (SLERP) Normalize to regain unit quaternion

Quaternions Can interpolate rotation well Compact representation Also easy to concatenate

Conversions Maths - Conversion Quaternion to Matrix - Martin Baker