Fundamentals of Computer Animation

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

Fundamentals of Computer Animation

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

Rotations in 3D Graphics and the Gimbal Lock

Transformations: 2D Transforms

CS770/870 Spring 2017 Quaternions

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

CS354 Computer Graphics Rotations and Quaternions

Animation and Quaternions

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

Orientation & Quaternions

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

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

Quaternions and Rotations

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

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

Quaternions and Rotations

Quaternions & Rotation in 3D Space

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

CS612 - Algorithms in Bioinformatics

GEOMETRIC TRANSFORMATIONS AND VIEWING

Analysis of Euler Angles in a Simple Two-Axis Gimbals Set

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

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

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

Animation Curves and Splines 2

Representations and Transformations. Objectives

Autonomous Navigation for Flying Robots

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

Visual Recognition: Image Formation

12.1 Quaternions and Rotations

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

CS184: Using Quaternions to Represent Rotation

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

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

CMSC 425: Lecture 6 Affine Transformations and Rotations

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

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

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

Quaternions and Rotations

Quaternions and Rotations

Quaternion Rotations AUI Course Denbigh Starkey

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

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

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Vector Algebra Transformations. Lecture 4

Rotation with Quaternions

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

Overview. By end of the week:

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

PSE Game Physics. Session (3) Springs, Ropes, Linear Momentum and Rotations. Oliver Meister, Roland Wittmann

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

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

Lecture Note 3: Rotational Motion

3D Modelling: Animation Fundamentals & Unit Quaternions

3D Kinematics. Consists of two parts

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Visualizing Quaternions

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

Working With 3D Rotations. Stan Melax Graphics Software Engineer, Intel

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

Transformations Week 9, Lecture 18

Advanced Computer Graphics Transformations. Matthias Teschner

2D and 3D Coordinate Systems and Transformations

Lab 2A Finding Position and Interpolation with Quaternions

Quaternions and Euler Angles

Transformations. Questions on Assignment 1? Announcements

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

2D/3D Geometric Transformations and Scene Graphs

Computer Animation II

Inertial Measurement Units II!

Le s s on 02. Basic methods in Computer Animation

Specifying Complex Scenes

Transformation Algebra

Coordinate Frames and Transforms

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

Chapter 2 - Basic Mathematics for 3D Computer Graphics

Computer Graphics Geometric Transformations

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

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

IntroductionToRobotics-Lecture02

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

3D Rotation: more than just a hobby

Exercise 1: Kinematics of the ABB IRB 120

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Moving Objects. We need to move our objects in 3D space.

MTRX4700 Experimental Robotics

Hello, welcome to the video lecture series on Digital Image Processing. So in today's lecture

Answers. Chapter 2. 1) Give the coordinates of the following points:

Review of Thursday. xa + yb xc + yd

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

CS5620 Intro to Computer Graphics

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems

METR Robotics Tutorial 2 Week 3: Homogeneous Coordinates SOLUTIONS & COMMENTARY

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

Translation. 3D Transformations. Rotation about z axis. Scaling. CS 4620 Lecture 8. 3 Cornell CS4620 Fall 2009!Lecture 8

Aalto CS-C3100 Computer Graphics, Fall 2016

Transcription:

Fundamentals of Computer Animation Orientation and Rotation University of Calgary GraphicsJungle Project CPSC 587 5 page

Motivation Finding the most natural and compact way to present rotation and orientations Orientation interpolation which result in a natural motion A closed mathematical form that deals with rotation and orientations (expansion for the complex numbers) University of Calgary GraphicsJungle Project CPSC 587 5 page

Rotation Matrix A general rotation can be represented by a single 3x3 matrix Length Preserving (Isometric) Reflection Preserving Orthonormal R = u v w x x x u v w y y y u v w z z z University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Object Representation Define object in world space Object space data Scale Rotation Translation Desired operations Interpolation between transformations Concatenation of one transformation after another Handle scale, rotation, translation, independently Rotation deserves special attention! University of Calgary GraphicsJungle Project CPSC 587 5 page 4

University of Calgary GraphicsJungle Project CPSC 587 5 page 5 Rotation Matrix Representation = z y x z y x z y x w w w v v v u u u R = = = cos sin sin cos ) ( cos sin sin cos ) y - roll( cos sin sin cos ) ( 3 3 3 3 3 roll z roll x This could be the Upper 3x3 of a 4x4 homogeneous matrix Pure rotation is special orthogonal inverse = transpose

Repeated Rotations: Error Management Method M = create_rotation_matrix( ) Object = apply M to Object Method D = create_rotation_matrix( ) M create_rotation_matrix() M = D M Object = apply M to object Method 3 = + M = create_rotation_matrix() Object = apply M to object <= repeat {p = Mp} round off error accumulates <= repeat {p = Mp; M=DM} round off error accumulates in M no longer ortho-normal (orthogonal matrix) <= repeat error accumulates in but M orthogonal University of Calgary GraphicsJungle Project CPSC 587 5 page 6

Rotation Matrices - Can t interpolate rotation matrices - 9 o z-axis -9 o z-axis?? University of Calgary GraphicsJungle Project CPSC 587 5 page 7

Orientation Representation orientation University of Calgary GraphicsJungle Project CPSC 587 5 page 8

Interpolation O O.5 O University of Calgary GraphicsJungle Project CPSC 587 5 page 9

Other Representations alternative representations: Fixed Angle Euler Angle Axis Angle Quarternians University of Calgary GraphicsJungle Project CPSC 587 5 page

Fixed Angle Representation 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, e.g. first about x, then y, then z (x-y-z). Many possible orderings, don t have to use all 3 axes. x-x-y multiple rotations around same axis redundant University of Calgary GraphicsJungle Project CPSC 587 5 page

Fixed Angle Representation A rotation of,45, 9 would be written as Rz(9), Ry(45), Rx() since we want to first rotate about x, y, z. It would be applied then to the point P. RzRyRx P Problem occurs when two of the axes of rotation line up on top of each other. This is called Gimbal Lock University of Calgary GraphicsJungle Project CPSC 587 5 page

University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Concatenation O O University of Calgary GraphicsJungle Project CPSC 587 5 page 4

Fixed Angle Interpolation (,9,) to (9,,9) (,,) (,9,) (9,,9) University of Calgary GraphicsJungle Project CPSC 587 5 page 5

Gimbal Lock A 9 degree rotation about the y axis essentially makes the first axis of rotation align with the third. Incremental changes in x,z produce the same results you ve lost a degree of freedom i.e. rotating around z produces the same effect as rotate around x. (see program) since x is now z University of Calgary GraphicsJungle Project CPSC 587 5 page 6

Gimbal Lock Phenomenon of two rotational axis of an object pointing in the same direction. Simply put, it means your object won't rotate in an obvious fashion (this applies to interpolation too). University of Calgary GraphicsJungle Project CPSC 587 5 page 7

Euler Angles Euler Angle Rotation: Rotation around the rotating (local) axes. The axes of rotation are the axes of the local coordinate system fixed to the object. A general rotation is a combination of three elementary rotations: around the x-axis (x-roll), around the y-axis (y-roll) and around the z-axis (z-roll). University of Calgary GraphicsJungle Project CPSC 587 5 page 8

University of Calgary GraphicsJungle Project CPSC 587 5 page 9 Euler Angles and Rotation Matrices = = = cos sin sin cos ) ( cos sin sin cos ) y - roll( cos sin sin cos ) ( 3 3 3 3 3 roll z roll x + + = ),, ( 3 3 3 3 3 3 3 3 3 3 3 c c c s s s c s s c s c c s c c s s s s c c s s s s c c c R Need global

Euler Angles An Euler angle representation: e.g. x-y-z ordering specified as α,β,γ R(α) x-axis rotation R(β) y-axis rotation around y-axis of rotated local coordinate system. R is rotation around rotated frame, to implement the y-axis rotation: R y (β)r x (α)= R x (α)r y (β)r x (-α)r x (α)=r x (α)r y (β) implement with global axes rotations so Euler is identical to fixed angle system with reverse order of rotations. (see page 57). University of Calgary GraphicsJungle Project CPSC 587 5 page

Euler Angles Show that Euler angle ordering is equivalent to reverse ordering in fixed angles Use (z,y,x) Y y P = R z ( )P P = R z ( )R y ( )R z ( ) P P = R z ( )R y ( )R z ( )R z ( )P P = R z ( )R y ( )P P = R z ( )R y ( )R x ( 3 )R y ( )R z ( ) P P = R z ( )R y ( )R x ( 3 )R y ( )R z ( )R z ( )R y ( )P P = R z ( )R y ( )R x ( 3 )P Z z x X and so has the same problems University of Calgary GraphicsJungle Project CPSC 587 5 page

Gimbal Lock (again!) Rotation by 9 o causes a loss of a degree of freedom z z z y π/ y 3 y x x x x x University of Calgary GraphicsJungle Project CPSC 587 5 page

Euler angles interpolation y π x z x-roll π y x z R(,,),,R(πt,,),,R(π,,) t [,] Same problem as fixed angle inerpolation. y π x z y-roll π y π x z z-roll π y x z R(,,),,R(,πt, πt),,r(,π, π) University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Euler Angles Interpolation Unnatural movement! University of Calgary GraphicsJungle Project CPSC 587 5 page 4

Goal Find a parameterization in which a simple steady rotation exists between two key orientations moves are independent of the choice of the coordinate system University of Calgary GraphicsJungle Project CPSC 587 5 page 5

Axis Angle Interpolation (,n) defines an angular displacement of about an axis n Y A A X Z B=A x A cos - (A A ) = A.A B=A x A A K =R B (k.)a K =(-k) +k University of Calgary GraphicsJungle Project CPSC 587 5 page 6

Angle and Axis Any orientation can be represented by a 4-tuple angle, vector(x,y,z) where the angle is the amount to rotate by and the vector is the axis to rotate about Can interpolate the angle and axis separately No gimbal lock problems! But, can t efficiently compose rotations must convert to matrices first! University of Calgary GraphicsJungle Project CPSC 587 5 page 7

Quaternions? Extend the concept of rotation in 3D to 4D. Avoids the problem of "gimbal-lock" and allows for the implementation of smooth and continuous rotation. In effect, they may be considered to add a additional rotation angle to spherical coordinates ie. Longitude, Latitude and Rotation angles A Quaternion is defined using four floating point values w x y z. These are calculated from the combination of the three coordinates of the rotation axis and the rotation angle. University of Calgary GraphicsJungle Project CPSC 587 5 page 8

Quaternions q =[s,v]=[s,x,y,z] Α Has the same information as axis-angle but in a more computational-friendly form (cos(/),sin(/)*a) University of Calgary GraphicsJungle Project CPSC 587 5 page 9

How do quaternions relate to 3D animation? Solution to "Gimbal lock" Instead of rotating an object through a series of successive rotations, a quaternion allows the programmer to rotate an object through a single arbitary rotation axis. Because the rotation axis is specifed as a unit direction vector, it may be calculated through vector mathematics or from spherical coordinates ie (longitude/latitude). Quaternions interpolation : smooth and predictable rotation effects. University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Quaternions Definition Extension of complex numbers 4-tuple of real numbers s,x,y,z or [s,v] s is a scalar v is a vector Same information as axis/angle but in a different form Can be viewed as an original orientation or a rotation to apply to an object University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Quaternions Math - Definitions Quaternion Addition q = [s,v ] q = [s,v ] q +q = [s +s, v +v ] Quaternion multiplication associative (q.q ).q 3 = q.(q.q 3 ) Quaternion multiplication non commutative q = [s,v ] q = [s,v ] q.q = [s s v v, s v + s v + v x v ] q.q q.q University of Calgary GraphicsJungle Project CPSC 587 5 page 3

Quaternions Math Magnitude University of Calgary GraphicsJungle Project CPSC 587 5 page 33

Quaternion Rotation To rotate a vector, v using quaternion math represent the vector as [,v] represent the rotation as a quaternion, q v = Rot(v) = q.v.q - Unit quarternian rotated around axis (x,y,z) by amount q = Rot,(x,y,z) = [cos(/), sin(/).(x,y,z)] University of Calgary GraphicsJungle Project CPSC 587 5 page 34

Quaternion Rotation v = Rot(v)=q.v.q - Unit quarternian rotated around axis (x,y,z) by amount q = Rot,(x,y,z) =[cos(/), sin(/).(x,y,z)] Rotation by quarternian p followed by rotation by q on vector v: v is the quarternian [,v] Rot q (Rot p (v)) = q.(p.v.p - ).q - = ((qp).v.(qp) - ) =Rot qp (v) University of Calgary GraphicsJungle Project CPSC 587 5 page 35

Inverse Quaternion Rotation Inverse quarternian q - represents rotation in the opposite direction: Rot - (Rot(v)) = q -.(q.v.q - ).q= v Magnitude is divided out by multiplying by inverse (q.v.q - ) thus scalar multiples of quarternian represents same rotation as unit quarternian (similar idea as with homogeneous point representation). note that real part (scalar part) is R(z v z - )= R ( v z z - )=R(v )= v = [, v] University of Calgary GraphicsJungle Project CPSC 587 5 page 36

(-ve) Quaternion Rotation v = Rot(v)=q.v.q - Unit quarternian rotated around axis (x,y,z) by amount q = Rot,(x,y,z) = [cos(/), sin(/).(x,y,z)] -q = Rot -,-(x,y,z) =[cos(-/), sin(-/).(-(x,y,z))] =[cos(/), -sin(/).(-(x,y,z))] =[cos(/), sin(/).((x,y,z))] -q = q = Rot,(x,y,z) University of Calgary GraphicsJungle Project CPSC 587 5 page 37

Quaternion to Rotation Matrix Q = ( X Y Z W ) M = Y XY XZ + Z ZW YW XY ZW X Z YZ + XW XZ YZ X + YW XW Y University of Calgary GraphicsJungle Project CPSC 587 5 page 38

Quaternions as Rotations Rotation of P=(,r) about the unit vector n by an angle using the unit quaternion q=(s,v) R [ P] = qpq = (,( s v v) r + v( v r) + sv r) q but q=(cos½, sin½ n) where n = R q [ P] = (, (cos sin ) r ( n r)cos sin ) = (, cos r + ( cos ) + n( n r)sin n ( n r) + + ( n r)sin ) University of Calgary GraphicsJungle Project CPSC 587 5 page 39

University of Calgary GraphicsJungle Project CPSC 587 5 page 4 Quaternions as Rotations Concatenating rotations rotate using q and then using q is like rotation using q *q ) * *( )* * ( ) * *( )* * ( )* * * *( = = q q P q q q q P q q q q P q q

Rotations in Reality It s easiest to express rotations in Euler angles or Axis/angle We can convert to/from any of these representations Choose the best representation for the task input:euler angles interpolation: quaternions composing rotations: quaternions, orientation matrix University of Calgary GraphicsJungle Project CPSC 587 5 page 4

University of Calgary GraphicsJungle Project CPSC 587 5 page 4