Logistics Projects Interpolation of Quaternions Reminder that - - PDF document

logistics
SMART_READER_LITE
LIVE PREVIEW

Logistics Projects Interpolation of Quaternions Reminder that - - PDF document

Logistics Projects Interpolation of Quaternions Reminder that proposal is due before break. Assignments Reminder that Assignment 1 is due before break. Readings Keep those summaries coming Logistics Plan for today


slide-1
SLIDE 1

1

Interpolation of Quaternions

Logistics

 Projects

 Reminder that proposal is due before

break.

 Assignments

 Reminder that Assignment 1 is due before

break.

 Readings

 Keep those summaries coming

Logistics

 Grad Report

 Will need topics first week after we return

from break.

Plan for today

 Interpolation leftovers

 Interpolation of Quaternions  Assignment #2.

Plan for today

 Small change in plans

 Today: Keyframing and Interpolation  Wednesday: More on interpolation  Leave dynamics until we get back.

 New schedule on Web site  But first…

Motivation Films

 Computer Animated Feature Films (Theatrical

Release)

 44 since (and including) Toy Story  17 currently in Production  http://www.boxofficemojo.com/genres/chart/?id=computeranimation.htm

 Major players

 Pixar  PDI/Dreamworks  Blue Sky / FOX  Sony Imageworks  Disney

slide-2
SLIDE 2

2

Motivational Films

 Anyone know what is the most

successful computer animated feature film?

 Shrek 2 (PDI / Dreamworks)  Shrek the 3rd is 3rd  Shrek is 4th

Motivation Films

 Pacific Data Images (PDI)

 Makers of Shrek and ANTZ  Founded in 1980 (doing flying logos)  1990 – Morphing for Michael Jackson’s “Black and White” Video  1996 – Signed on with Dreamworks SKG to produce ANTZ  2000 – Aquired by Dreamworks (PDI/Dreamworks)  2001 – Shrek wins Oscar for best animated feature  2004 -- Shrek 2 becomes highest grossing animated feature.

Motivational Films

 Animated features by PDI/Dreamworks

 ANTZ (1999)  Shrek (2001)  Shrek 2 (2004)  Shark Tale (2004)  Madagascar (2005)  Over the Hedge (2006)  Flushed Away (2006)  Shrek the Third (2007)  Bee Movie (2007)

Motivational Films

 Films in the works by PDI/Dreamworks  In the works

 Kung Fu Panda (June 2008)  Madagascar II (Nov 2008)  Monsters and Aliens (May 2009)  How to Train Your Dragon (Nov 2009)  Shrek IV (May 2010)

Motivational Film

 Locomotion (1988)

 One of PDIs first animated shorts

Motivational Film

 Homer3 (1995)

 Aired as part of "Treehouse of Horror VI"

Simpsons Halloween special

slide-3
SLIDE 3

3

Let’s get started

an·i·ma·tion (n)

a motion picture made from a series of drawings simulating motion by means of slight progressive changes in the drawings

Coordinate Transformations

 How to specify placement of individual objects into a

scene

 Two coordinate systems

 Object coordinate system  World coordinate system

Transformation matrix

{ {

  • bject

tion transforma 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 world

1 1

  • =
  • w

w w

z y x m m m m m m m m m m m m m m m m z y x 4 4 4 4 3 4 4 4 4 2 1

translation rotation

Motion Control Algorithms

 Goal:

 Reduce the degrees of freedom to a

number that is manageable to an animator.

 Algorithms must provide a set of

“meaningful” parameters.

  • 6. Straight ahead action and Pose-to-pose

action

 The two main approaches to hand drawn

animation.

 Straight ahead action

 “the animator works straight ahead from his first drawing

in the scene.”

 Pose-to-pose (keyframing)

 the animator plans his actions, figures out just what

drawings will be needed to animate the business, makes the drawings concentrating on the poses, ... and then draws the inbetweens.”

 Link

Key framing

 The simplest form of animating an object.  Object has:

 A beginning state  An end state  A number of intermediate “key” states

 It is up to the keyframe system to determine

the states for inbetween frames

slide-4
SLIDE 4

4

Quaternions

 Similar idea to axis/angle  Define an orientation by a 4-tuple

 [w, x, y, z]  Or by a pair  [w, v] where w is a scalar and v is a 3d

vector.

Quaternion math

 Given 2 quaternions

 q1=[w1, x1, y1, z1] = [w1, v1]  q2=[w2, x2, y2, z2] = [w2, v2]

 Quaternion addition:

 q1 + q2 = [w1+w2, v1+v2]  q1 + q2 = [w1+w2, x1 + x2, y1 + y2, z1 + z2]

Quaternion math

 Quaternion multiplication

 (q1 * q2) = [w1w2 - v1⋅v2, w1v2 + w2v1 + v1×v2]  (q1 * q2).w = (w1w2 - x1x2 - y1y2 - z1z2)  (q1 * q2).x = (w1x2 + x1w2 + y1z2 - z1y2)  (q1 * q2).y = (w1y2 - x1z2 + y1w2 + z1x2)  (q1 * q2).z = (w1z2 + x1y2 - y1x2 + z1w2)

 Note: quaternion multiplication is not commutative.

Quaternion math

 Magnitide of a quaternion

 ||q1|| = sqrt (w1

2 + x1 2 + y1 2 + z1 2)

 Yes, you can (and should) normalize

quaternions.

 Identity properties

[ ] [ ] [ ]

1 1

1 2 1

= − = =

− −

qq q v s q q q

Quaternions and rotation.

 Quaternions essentially encodes the info

  • f an axis/angle rotation

R α, (x,y,z) = [ cos(α /2), sin (α /2) • (x, y, z) ]

Nomenclature note: α rather than θ

Quaternion math

 Quaternion dot product

cos = q1 •q2 = w1w2 + (v1 •v2)

θ Is angle between quaternions in quaternion space

slide-5
SLIDE 5

5

Quaternions

 A series of rotations can be

accomplished by using quaternion multiplication

 Rotation by p then by q is the same as

rotation by qp

Quaternions

 To interpolate quaternions

 Interpolate each element one at a time  Sort of….

 By the way,

 Gentle mathematic treatment of quaternions and

rotation (including interpolation) on READING LIST

Interpolating Quaternions

 In animation, only unit quaternions

should be used

 Normalize those quaternions!

 Quaternions live in 4-D space

 Normalized quaternions will lie on the unit

4D sphere.

Interpolating Quaternions

 Direct interpolation of quaternion

components can give “misleading” results.

 Figure 6-3 in quat paper.

Interpolating Quaternions

 Direct interpolation of quaternion

components can give “misleading” results.

Spherical linear interpolation (Slerp)

Linear interpolate angle along hypersphere

slide-6
SLIDE 6

6

Interpolating Quaternions

 Spherical Linear Interpolation (Slerp)

 recall

  • sin

) sin( sin ) ) 1 sin(( ) , ( slerp

2 1 , 2 1

u q u q u q q +

  • =

Note that result of slerp is not necessarily unit length (even if keyframes are)…Normalization required!

cos = q1 •q2 = w1w2 + (v1 •v2)

Interpolating Quaternions

 Spherical Linear Interpolation (Slerp)

 slerp (q1,q2, 1/2) can be efficiently

computed (within a scale factor) as q1+ q2

 Scale factor okay since you’ll need to

normalize anyway.

Interpolating Quaternions

 Comparison of Lerp and Slerp

Interpolating Quaternions

 Note:

 Spherical Linear Interpolation has the same problem as

linear interpolation (no tangential continuity)

 For smooth interpolation, Shomake recommends the use

Bezier curves

 Issues:  But what about those control points?  How does one do “cubic interpolation” in quaternion space

 Section 3.3.1 (page 110) in Parent text

Cubic Interpolation

 Bezier Curves

 specified by endpoints and intermediate

points, not on the curve, that approximate the tangent vectors

Cubic Interpolation

 Bezier Curves

  • =

1 3 3 3 6 3 1 3 3 1

B

M

  • =

3 2 1

P P P P GH Let’s go to the video tape

slide-7
SLIDE 7

7

Bezier control points

 Defining control points:

 Assume you need the path between pn and

pn+1

 For each pn, you’ll need 2 control points,

  • ne before it and one after it.

Bezier control points

 Defining control points

 Algorithm:

 For a point pn:  For control point after (an):

 Take vector from pn-1 to pn and add to pn (Point

1)

 Take average of Point 1 with pn+1 to define

control point an

 For control point before (bn)  Take vector from an to pn  Add it to pn to get bn

Bezier control points Bezier control points

 Control points for end conditions:

 First control point (a0)

 Take the vector from p2 to p1 and add to p1  Similar for last control point.

Quaternions and Bezier

 Applying this to quaternions

 Adding vectors == concatenating rotations

 Quaternion multiplication in reverse

 Averaging == slerp to midpoint (u = 1/2)

 The same as quaternion addition.

 Questions? Break

So far

 We have:

 Rotation keyframes defined as quaternions  We have Bezier control points

 What we need:

 The interpolated rotations between

keyframes.

slide-8
SLIDE 8

8

Interpolating rotations

 Applying spline definition

 Becomes messy fast  Instead, use De Casteljau construction.

De Casteliau construction

 DeCasteljau Construction

 Geometric means of finding values of Bezier

Curves using repeated use of linear interpolation.

de Casteljau Construction

p0 p1 p2 p3

Start with the control points

And given a value of t

In the drawings, t≈0.25

de Casteljau Construction

p0 q0 p1 p2 p3 q2 q1

q0(t) = Lerp t,p0,p1

( )

q1(t) = Lerp t,p1,p2

( )

q2(t) = Lerp t,p2,p3

( )

de Casteljau Constuction

q0 q2 q1 r1 r0

r0(t) = Lerp t,q0(t),q1(t)

( )

r

1(t) = Lerp t,q1(t),q2(t)

( )

de Casteljau Construction

r1 x r0 •

x(t) = Lerp t,r0(t),r

1(t)

( )

Applet

slide-9
SLIDE 9

9

De Casteljau and Quats

 In Quaternion world

 Use slerp instead of lerp  If you calculate for u as powers of 2:

 Repeated bisection  Slerp (u=1/2) is the same as quat addition.

 Questions?

Now on to Assignment 2