Animation and Quaternions

Similar documents
CS5620 Intro to Computer Graphics

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

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

Animating orientation. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Quaternions and Rotations

Quaternions and Rotations

Animation. Traditional Animation Keyframe Animation. Interpolating Rotation Forward/Inverse Kinematics

CS354 Computer Graphics Rotations and Quaternions

Fundamentals of Computer Animation

12.1 Quaternions and Rotations

Coordinate Transformations. Coordinate Transformation. Problem in animation. Coordinate Transformation. Rendering Pipeline $ = $! $ ! $!

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

Quaternions and Rotations

Quaternions and Rotations

Fundamentals of Computer Animation

Animation Curves and Splines 2

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 COORDINATE TRANSFORMS. Prof. Steven Waslander

CS770/870 Spring 2017 Quaternions

Computer Animation II

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Rotations in 3D Graphics and the Gimbal Lock

Orientation & Quaternions

Transformations Week 9, Lecture 18

Quaternion Rotations AUI Course Denbigh Starkey

Transformations: 2D Transforms

Animations. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Kavita Bala

Quaternion properties: addition. Introduction to quaternions. Quaternion properties: multiplication. Derivation of multiplication

Quaternions & Rotation in 3D Space

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

IMAGE-BASED RENDERING AND ANIMATION

CS 475 / CS 675 Computer Graphics. Lecture 16 : Interpolation for Animation

3D Kinematics. Consists of two parts

CS 775: Advanced Computer Graphics. Lecture 3 : Kinematics

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

Animation. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 4/23/07 1

3D Modelling: Animation Fundamentals & Unit Quaternions

a a= a a =a a 1 =1 Division turned out to be equivalent to multiplication: a b= a b =a 1 b

Visual Recognition: Image Formation

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

CS184: Using Quaternions to Represent Rotation

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

Jorg s Graphics Lecture Notes Coordinate Spaces 1

Le s s on 02. Basic methods in Computer Animation

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

3D Rotations and Complex Representations. Computer Graphics CMU /15-662, Fall 2017

Rotational Joint Limits in Quaternion Space. Gino van den Bergen Dtecta

CS230 : Computer Graphics Lecture 12: Introduction to Animation. Tamar Shinar Computer Science & Engineering UC Riverside

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

Splines & Quaternions (splines.txt) by Jochen Wilhelmy a.k.a. digisnap

CS612 - Algorithms in Bioinformatics

Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation

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

animation computer graphics animation 2009 fabio pellacini 1 animation shape specification as a function of time

Computer Graphics with OpenGL ES (J. Han) Chapter IV Spaces and Transforms

animation computer graphics animation 2009 fabio pellacini 1

Animation. CS 4620 Lecture 19. Cornell CS4620 Fall 2013 Lecture Steve Marschner (with previous instructors James/Bala)

SUMMARY. CS380: Introduction to Computer Graphics Track-/Arc-ball Chapter 8. Min H. Kim KAIST School of Computing 18/04/06.

Animation. Animation

3D Transformations and Complex Representations. Computer Graphics CMU /15-662, Fall 2016

For each question, indicate whether the statement is true or false by circling T or F, respectively.

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

Rectangular Coordinates in Space

Why animate humans? Why is this hard? Aspects of the Problem. These lectures. Animation Apreciation 101

Rotation parameters for model building and stable parameter inversion in orthorhombic media Cintia Lapilli* and Paul J. Fowler, WesternGeco.

Aalto CS-C3100 Computer Graphics, Fall 2016

Quaternions. Ken Shoemake Department of Computer and Information Science University of Pennsylvania Philadelphia, PA 19104

VISUALIZING QUATERNIONS

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Quaternion to Euler Angle Conversion for Arbitrary Rotation Sequence Using Geometric Methods

CS 130 Final. Fall 2015

Quaternions and Exponentials

Lab 2A Finding Position and Interpolation with Quaternions

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

Chapter 3 : Computer Animation

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

INF3320 Computer Graphics and Discrete Geometry

Quaternions and Euler Angles

The Three Dimensional Coordinate System

Rotation with Quaternions

Reading. Topics in Articulated Animation. Character Representation. Animation. q i. t 1 t 2. Articulated models: Character Models are rich, complex

Introduction to quaternions. Mathematics. Operations

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Visualizing Quaternions

Animation. CS 465 Lecture 22

Intro to Curves Week 1, Lecture 2

Rotations for N-Dimensional Graphics

Advanced Computer Graphics Transformations. Matthias Teschner

Kinematics and Orientations

Visualizing Quaternions

2D Object Definition (1/3)

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

COMPUTER ANIMATION 3 KEYFRAME ANIMATION, RIGGING, SKINNING AND CHARACTER ANIMATION. Rémi Ronfard, Animation, M2R MOSIG

Kinematical Animation.

3D Game Engine Programming. Understanding Quaternions. Helping you build your dream game engine. Posted on June 25, 2012 by Jeremiah van Oosten

CMSC 425: Lecture 6 Affine Transformations and Rotations

Animation Lecture 10 Slide Fall 2003

CS770/870 Spring 2017 Animation Basics

CS770/870 Spring 2017 Animation Basics

Transcription:

Animation and Quaternions Partially based on slides by Justin Solomon: http://graphics.stanford.edu/courses/cs148-1-summer/assets/lecture_slides/lecture14_animation_techniques.pdf 1

Luxo Jr. Pixar 1986 movie

A New Dimension - Time 3

4

Traditional Animation Anticipation Secondary Action Squash/Stretch 5

Specifying Animation http://sphmajor.files.wordpress.com/1/5/leaping_cat_by_animation_stock.jpg Specifying every frame is hard 6

Keyframes Automatically fill in motion between these points in time. http://graphics.stanford.edu/courses/cs148-1-summer/docs/1_anim_interact.pdf Specify significant poses 7

Not a New Idea http://www.superrune.com/technical/tutorial_breakdown.php Tweening: Not a fun job! 8

CAPS, Late 198s Digital ink and paint system. Rescuers Down Under, 199 http://img-3.timeinc.net/ew/i/11/1/6/rescuers-down-under_61.jpg Computer-Aided Production System9

CAPS, Late 198s http://www.youtube.com/watch?v=cke5u9fsgse Computer-Aided Production System1

Software for Keyframed Animation Artist specifies keyframes, computer does tweening. 11

Software for Keyframed Animation Artist specifies keyframes, computer does tweening. 1

Representing Motion http://3.bp.blogspot.com/-gig9r_-wbk8/t5pcek9leui/aaaaaaaaahc/o5is6dg_6f4/s16/ball_bounce_sketch.jpg http://www.blendernation.com/wp-content/uploads/7/9/blendermodo.png http://ncca.bournemouth.ac.uk/gallery/files/innovations/4/gonzalez_lisa_11/images/medium/thumbnail.jpg http://web.cecs.pdx.edu/~fliu/project/vbha/video%based%animation.jpg Choose structure for desired motion 13

Rigid Motion Location Representation: Position in space Interpolation: a spline Orientation Representation? Interpolation? 14

Rotation Matrices? 15

D Rotation Representation Rotation matrix Rotation angle θ Complex number e 16

Orientation and Euler Angles The orientation of any 3D object may be described by three Euler angles: successive rotations (relative to an initial orientation) around three axes: x-roll: rotation around x axis. y-roll: rotation around y axis. z-roll: rotation around z axis. The order of rotation application is important, as rotations do not commute. An obvious way to interpolate two orientations is to interpolate their Euler angles. 17

18 1 1 ) ( R x 1 1 ) ( R y 1 1 ) ( R z Rotation by Euler Angles

19 When this is: where = +, so one degree of freedom is lost. 1 ),, ( x y z R R R R 1 1 1 1 Gimbal Lock

Gimbal Lock

General Rotations Euler, 1756 v 1 n Theorem: (Euler): Any orientation can be obtained from a fixed reference orientation by a gle unique rotation around an appropriate axis in space. v Therefore, any orientation may be described by four parameters: angle and unit axis n=(n x,n y,n z ). 1

General Rotations (cont d) n Rv () Rv ( v) v v Rv ( ) Rv ( ) ( nv) ( nvn ) ( v( nvn ) ) ( nv) v n( nv)(1 ) ( nv) v nv v v R( v ) v ( nv) n v vv Rv ( ) v ( nv) Rv ( ) v ( nv) v

Quaternions Definition: A quaternion is a quadruple q=[s,v], where s is a scalar, and v a three-dimensional vector. Rotation by around unit direction n may be represented by the unit quaternion q[, n ] The 3D vector [,v] is rotated by q to: 1 R v q vq q () 3

Quaternions Hamilton 1843 Definition: A quaternion is a quadruple q=[s,v], where s is a scalar, and v a three-dimensional vector. The quaternions form a non-commutative group under the multiplication rule: q q [ s, v ] [ s, v ] 1 1 1 [ s s v v, sv s v v v ] 1 1 1 1 1 Equivalent to: q s iv x jv y kv z where i j k 1, ij k, ji k 4

Quaternions (cont d) The conjugate of q [ s,v] is q [ s,-v] q q q q 1 1 The inverse of q [ s,v] is: q -1 q q Corollary: The norm of q [ s,v] is x y z q q q s v v v q q q q 1 1 5

Special Cases Scalars: [c,(,,)] Complex numbers: [x,(y,,)] 3D Vectors: [,(x,y,z)] q q [ s, v ] [ s, v ] 1 1 1 [ ss v v, sv sv v v ] 1 1 1 1 1 6

Rotating with Quaternions Rotation by around unit direction n may be represented by the unit quaternion The 3D vector [,v] is rotated by q to: Since R () v [, n ][,][ v, n ] q 1 R v q vq qvq q () q[, n ] q q [ s, v ] [ s, v ] [ ss v v, sv s v v v ] 1 1 1 1 1 1 1 1 Rv () Rv ( v ) Rv ( ) Rv ( ) v v ( nv) ( nvn ) ( v( nvn ) ) ( nv) v n( nv)(1 ) ( nv) [, v( ) n( nv) ( nv) ] [, v n( nv)(1 ) ( nv) ] 7

right hand coordinate system Examples y x z n q (,1,), n (,,1), / n (1,,), / (1,,,) q (1/,,, 1/ ) q (1/,1/,,) q (, n ) ( w, x, y, z) 8

Unit Quaternions The quaternions used for rotation have only three degrees of freedom. They all lie on the surface of a unit sphere in 4D space, forming a subgroup. Theorem: A vector v is invariant under rotations around an axis through v. Proof: The rotation operator is q=[s,cv] such that q =1. q v q [, s cv][, v][, s cv] [, s cv][ cvv, sv] [, sv c( vvv ) ] ( s c ( vv))[, v] v q v Theorem: Rotation by and - in the opposite direction are equivalent. Proof: [, n ] [, ] n Theorem: Rotation by 1 and then by (around n) is equivalent to rotation by 1 +. ( q ( q vq ) q ) ( q q ) v( q q ) Proof: 1 1 1 1 ( q q ) v( q q ) [, ] [, ] 1 1 1 1 n n 1 1 1 1 1 1 n [, n( ] [, ] 9

Quaternion to Rotation Matrix (column vectors) Rotation by unit-length quaternion: q[, n ] [ w, x, y, z] R ([, v]) q[, v] q q v n( nv)(1 ) ( nv) The first row of the equivalent rotation matrix: R([, v]) v n( nv nv nv)(1 ) ( nv nv) q x x x x x y y z z y z z y M 11 1 13 nx (1 ) M n n (1 ) n x y z M n n (1 ) n x z y 3

Quaternion to Rotation Matrix (column vectors) q [, n ] [ w, x, y, z] M 11 nx (1 ) 1 n ( ) x 1( n n n ) n ( ) x y z x 1( n n ) 1y z y z M 1 y z xy wz xz wy xy wz 1 x z yz wx xz wy yz wx 1 x y 1 31

Rotation Matrix to Quaternion Given rotation matrix M M11 M1 M13 M1 M M3 M31 M3 M33 1 The equivalent quaternion is q = [w, x, y, z] M M M 144( y z x ) 4w 11 33 1 y z xy wz M xz wy xy wz 1 x z yz wx xz wy yz wx 1 x y 1 M11 M M33 1 w M M M3 M3 4 wx x 4w M M M13 M31 4 wy y 4w M M M1 M1 4 wz z 4w 3 3 13 31 1 1 3

right hand coordinate system Examples y x z n (,1,), q (1,,,) 1 M 1 1 n (,,1), / q (1/,,, 1/ ) 1 M 1 1 n (1,,), / q (1/,1/,,) 1 M 1 1 q (, n ) ( w, x, y, z) 33

Prove Ug Quaternions and Matrices The quaternion i=(,1,,) is rotation by around the x axis. The quaternion j=(,,1,) is rotation by around the y axis. The quaternion k=(,,,1) is rotation by around the z axis. 34

Animation in VRML DEF PI PositionInterpolator { key [.5 1 ] t i keyvalue [ 5, (x(t i ) y(t i ) z(t i )) 5, 5 ]} DEF OI OrientationInterpolator { key [ 1 ] keyvalue [ 1, -1 1.57796, ]} t i (n x (t i ) n y (t i ) n z (t i ) (t i )) quaternion rotation without quaternions rotation with quaternions 35

Geodesics A great circle is a circle on the surface of a sphere that has the same circumference as the sphere, dividing the sphere into two equal hemispheres. A great circle is a spherical geodesic the shortest path between two points on a sphere. 36

Interpolating Two Orientations Orientations may be interpolated by interpolating their respective quaternions. Quaternions on a 4D sphere may be interpolated along a geodesic (the shortest path between two points on a sphere). For any u[,1], writing q(u) = (u)q +(u)q 1, and solving the following system of equations for (u) and (u): q q q, q 1 1 1 qu ( ) ( u) ( u) ( u) ( u) q, q ( u) q, q( u) ( u) ( u) q, q 1 1 q u q(u) q 1 u[,1] q() q q(1) q 1 37

q, q 1 1 q, q1 ( u) q, q 1 1 ( u) (1 u ) 1 u (1 u) ( u) ( u) Spherical Linear Interpolation (SLERP) (1 u) ( u ) qu ( ) q q1 u[,1] Equivalent to: qu ( ) q( q q) u 1 1 38

Interpolating Multiple Orientations As with linear interpolation between multiple positions, spherical linear interpolation between multiple orientations generates discontinuities in the derivative at the interpolated points. This may be solved by more elaborate interpolation schemes, which are not shortest path, similarly to splines for positions. v v 3 v q q q 1 v 1 39