Fundamentals of Computer Animation



Similar documents
Animation (-4, -2, 0 ) + (( 2, 6, -4 ) - (-4, -2, 0 ))*.75 = (-4, -2, 0 ) + ( 6, 8, -4)*.75 = (.5, 4, -3 ).

Computer Animation. Lecture 2. Basics of Character Animation

CS 4620 Practicum Programming Assignment 6 Animation

Understanding Rotations

Rotation Matrices and Homogeneous Transformations

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

Metrics on SO(3) and Inverse Kinematics

Essential Mathematics for Computer Graphics fast

Two vectors are equal if they have the same length and direction. They do not

3D Tranformations. CS 4620 Lecture 6. Cornell CS4620 Fall 2013 Lecture Steve Marschner (with previous instructors James/Bala)

Computing Euler angles from a rotation matrix

Vector Math Computer Graphics Scott D. Anderson

Geometric Transformation CS 211A

Section 1.1. Introduction to R n

Sect Greatest Common Factor and Factoring by Grouping

Kinematical Animation

w = COI EYE view direction vector u = w ( 010,, ) cross product with y-axis v = w u up vector

animation animation shape specification as a function of time

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science. Friday 18 th January 2008.

Exam 1 Sample Question SOLUTIONS. y = 2x

11.1. Objectives. Component Form of a Vector. Component Form of a Vector. Component Form of a Vector. Vectors and the Geometry of Space

Section 1.4. Lines, Planes, and Hyperplanes. The Calculus of Functions of Several Variables

How To Draw A 3D Virtual World In 3D Space (Computer Graphics)

Interactive Computer Graphics

Introduction to Computer Graphics Marie-Paule Cani & Estelle Duveau

Goldsmiths, University of London. Computer Animation. Goldsmiths, University of London

discuss how to describe points, lines and planes in 3 space.

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

Rotating Objects Using Quaternions

Physics 235 Chapter 1. Chapter 1 Matrices, Vectors, and Vector Calculus

Part I. Basic Maths for Game Design

Affine Transformations

9 Multiplication of Vectors: The Scalar or Dot Product

L 2 : x = s + 1, y = s, z = 4s Suppose that C has coordinates (x, y, z). Then from the vector equality AC = BD, one has

animation shape specification as a function of time

3D Viewing. Chapter 7. Projections. 3D clipping. OpenGL viewing functions and clipping planes

Line and surface integrals: Solutions

CS 4204 Computer Graphics

VECTOR ALGEBRA A quantity that has magnitude as well as direction is called a vector. is given by a and is represented by a.

The Vector or Cross Product

Solutions to Practice Problems

TWO-DIMENSIONAL TRANSFORMATION

Geometry of Vectors. 1 Cartesian Coordinates. Carlo Tomasi

Orthogonal Projections

Lecture L3 - Vectors, Matrices and Coordinate Transformations

Solving Simultaneous Equations and Matrices

LINEAR ALGEBRA W W L CHEN

Rigid body dynamics using Euler s equations, Runge-Kutta and quaternions.

Inner Product Spaces and Orthogonality

9 MATRICES AND TRANSFORMATIONS

Concepts in Calculus III

2D Geometric Transformations

A vector is a directed line segment used to represent a vector quantity.

Section 9.5: Equations of Lines and Planes

Maya 2014 Basic Animation & The Graph Editor

CS 4204 Computer Graphics

Lectures notes on orthogonal matrices (with exercises) Linear Algebra II - Spring 2004 by D. Klain

DEFINITION A complex number is a matrix of the form. x y. , y x

α = u v. In other words, Orthogonal Projection

A QUICK GUIDE TO THE FORMULAS OF MULTIVARIABLE CALCULUS

Linear algebra and the geometry of quadratic equations. Similarity transformations and orthogonal matrices

x1 x 2 x 3 y 1 y 2 y 3 x 1 y 2 x 2 y 1 0.

Automatic Gesture Recognition and Tracking System for Physiotherapy

APPLICATIONS. are symmetric, but. are not.

MODELLING A SATELLITE CONTROL SYSTEM SIMULATOR

Question 2: How do you solve a matrix equation using the matrix inverse?

Vector surface area Differentials in an OCS

Origins of the Unusual Space Shuttle Quaternion Definition

Lecture 7. Matthew T. Mason. Mechanics of Manipulation. Lecture 7. Representing Rotation. Kinematic representation: goals, overview

(2,4,5).. ...

Objectives After completing this section, you should be able to:

B4 Computational Geometry

( ) which must be a vector

SMT 2014 Algebra Test Solutions February 15, 2014

Processing Data with rsmap3d Software Services Group Advanced Photon Source Argonne National Laboratory

Vector Notation: AB represents the vector from point A to point B on a graph. The vector can be computed by B A.

Geometric Camera Parameters

With the Tan function, you can calculate the angle of a triangle with one corner of 90 degrees, when the smallest sides of the triangle are given:

ANALYTICAL METHODS FOR ENGINEERS

[1] Diagonal factorization

Review Sheet for Test 1

Math 215 HW #6 Solutions

Lecture 2: Homogeneous Coordinates, Lines and Conics

CATIA V5 Tutorials. Mechanism Design & Animation. Release 18. Nader G. Zamani. University of Windsor. Jonathan M. Weaver. University of Detroit Mercy

(a) We have x = 3 + 2t, y = 2 t, z = 6 so solving for t we get the symmetric equations. x 3 2. = 2 y, z = 6. t 2 2t + 1 = 0,

Numerical Analysis Lecture Notes

v 1 v 3 u v = (( 1)4 (3)2, [1(4) ( 2)2], 1(3) ( 2)( 1)) = ( 10, 8, 1) (d) u (v w) = (u w)v (u v)w (Relationship between dot and cross product)

Continuous Groups, Lie Groups, and Lie Algebras

MATH2210 Notebook 1 Fall Semester 2016/ MATH2210 Notebook Solving Systems of Linear Equations... 3

Basic Problem: Map a 3D object to a 2D display surface. Analogy - Taking a snapshot with a camera

THREE DIMENSIONAL GEOMETRY

Given a point cloud, polygon, or sampled parametric curve, we can use transformations for several purposes:

SAT Subject Math Level 2 Facts & Formulas

State of Stress at Point

Mohr s Circle. Academic Resource Center

CMSC 425: Lecture 13 Animation for Games: Basics Tuesday, Mar 26, 2013

Transcription:

Fundamentals of Computer Animation Quaternions as Orientations () page 1

Visualizing a Unit Quaternion Rotation in 4D Space ( ) = w + x + y z q = Norm q + q = q q [ w, v], v = ( x, y, z) w scalar q =, = Arbitrary axis Angle of rotation q form a sphere of unit length in the 4D space You can get a 180 degree rotation of a quaternion by simply inverting the scalar (w) component page

Multiplying Quaternions q1 = (w1, x1, y1, z1); q = (w, x, y, z); q1 * q = ( w1.w - v1.v, w1.v + w.v1 + v1 X v) where v1 = (x1, y1, z1) v = (x, y, z) Order of multiplication is important! Quaternion multiplication is not commutative: q1 * q does not equal q * q1 page 3

Conversion From Quaternions Quaternion to Matrix ( w, x, y z) q =, To form a matrix equivalent to a unit quarternian: (w +x +y +z )=1 The columns are rotations of the principal axes by the unit quarternian, to rotate an axis v by the quarternian q: v rot = qvq -1 thus it is relatively simple to calculate the conversion matrix below. Matrix = 1 y xy xz + y zw z yw xy 1 x yz + zw z xw xz yz 1 x + yw xw y page 4

Converting quarternian to matrix M 0,0 M 0,1 M 0, M 1,0 M 1,1 M 1, Matrix M,0 M,1 M, = 1 y y xy + zw xz yw z xy zw 1 x z yz + xw xz + yw yz xw 1 x y Sum of diagonals= 1-y -z +1-x -z + 1-x -y = 3-4x 4y -4z But (w +x +y +z )=1 so sum = 3 4(1-w ) = 4w 1 w = sqrt(1+m 0,0 +M 1,1 + M, )/ M 0,0 =1-y -z =1 - (y +z ) = 1 (1 - x +w ) = x +w 1 similarly for y and z x = sqrt(1/(m 0,0 +1-w )) y = sqrt(1/(m 1,1 +1-w )) Z = sqrt(1/(m, +1-w )) page 5

Conversion From Quaternions Quaternion to Axis Angle To change a quaternion to a rotation around an arbitrary axis in 3D space: Axis of rotation (ax, ay, az) angle theta (radians) then angle= * acos(w) ax= x / scale ay= y / scale az= z / scale where scale = x + y + z if the scale is 0 no rotation and the axis will be infinite. In this case: Set the rotation axis to any unit vector with a rotation angle of 0. page 6

Example Camera Orientation Euler glrotatef( anglex, 1, 0, 0) glrotatef( angley, 0, 1, 0) glrotatef( anglez, 0, 0, 1) // translate Quaternion // convert Euler to quaternion // convert quaternion to axis angle glrotate(theta, ax, ay, az) // translate Gimbal Lock? YES YES page 7

Conversion To Quaternions Axis Angle to Quaternion Axis of rotation (ax, ay, az) /* must be unit vectors */ angle theta (radians) then w = cos (theta/) x = ax * sin (theta/) y = ay * sin (theta/) z = az * sin (theta/) If the axis is a zero vector no rotation In this case: Set the quaternion to the rotation identity quaternion q= [1,(0, 0, 0)] page 8

Conversion To Quaternions Euler to Quaternion if you have three Euler angles (a, b, c), then you can form three independent quaternions: Qx = [ cos(a/), (sin(a/), 0, 0) ] Qy = [ cos(b/), (0, sin(b/), 0) ] Qz = [ cos(c/), (0, 0, sin(c/)) ] And the final quaternion is obtained by Qx * Qy * Qz. page 9

How can quaternions avoid Gimbal Lock? Basic Idea: 1. Use a quaternion to represent the rotation.. Generate a temporary quaternion for the change from the current orientation to the new orientation. 3. PostMultiply the temp quaternion with the original quaternion. This results in a new orientation that combines both rotations. 4. Convert the quaternion to a matrix and use matrix multiplication as normal. page 10

Linearly interpolating fixed angles from (0,90,0) to (90,0,90) Interpolating quaternions from (0.5,0.0,1.0,0.0) to (0.5,0.5,0.5,0.5) using spherical linear interpolation page 11

Quaternion Interpolation Fixed angles (0,90,0) (90,0,90) quaternions [0.7,0.0,0.7,0.0] [0.5,0.5,0.5,0.5] page 1

Quaternions as points on a 4D sphere Unit quaternion: q=(s,x,y,z), q = 1 Want equal increment along arc connecting two quaternions on surface of sphere spherical linear interpolation

Quaternion Interpolation Equally spaced linear interpolation of straight-line path between two points on a circle generate unequal spacing of points after projecting onto a circle. page 14

Interpolation of Rotations How can we interpolate between two quaternion rotations along the shortest arc? Spherical Linear interpolation (SLERP) SLERP ( q q, t) = q sin (( 1 t) θ ) + q sin( tθ ) sin( θ ) 1 1, cosθ = q 1 q s 1,s + v 1 v Nick Bobick Rotating Objects Using Quaternions GameDeveloper, Feb 1999 page 15 (available at course website)

Interpolation Scalar: K = (1-α) A + α B (linear interpolation: lerp) Euler Angles: [x,y,z] = (1- α)[x a,y a,z a ] + α[x b,y b,z b ] Quaternions?: Linear interpolation of quaternion values would give unequal rotation increments - need to slerp (spherical linear interpolation) page 16

Orientation two representations The closer of the two representations of orientation is the better choice to use in interpolation. page 17

SLERP q form a sphere of unit length in the 4D space SLERP ( q q, t) q sin (( 1 t) θ ) + q sin( tθ ) sin( θ ) 1 1, = page 18

Practical use for quaternions (1) Camera rotations in third-person-perspective games

Practical use for quaternions (1) Camera rotations in third-person-perspective games page 0

Practical use for quaternions () Prerecorded (but not prerendered) animations Instead of recording camera movements by playing the game (as many games do today), you could prerecord camera movements and rotations using a commercial package such as Softimage 3D or 3D Studio MAX. Then, using an SDK, export all of the keyframed camera/object quaternion rotations. This would save both space and rendering time. Then you could just play the keyframed camera motions whenever the script calls for cinematic scenes. page 1