Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation...

46
Spacetime Constraints David Coyne Joe Ishikura

Transcript of Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation...

Page 1: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Spacetime Constraints

David Coyne

Joe Ishikura

Page 2: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

The challenge of kinematics

Successful animation requires control, but looks real

Traditional principles of animation look “right”

Page 3: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Problem

Keyframe animation Artist controls each

pose Time consuming Takes an expert to

make it look good

Control Accuracy

Physics simulations Looks realistic Almost no kinematic

controlForward simulation

using time-dependent force functions looks bad

Page 4: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

If only…

We could produce motion to achieve a goal, rather than just simulate starting conditions

The solution would show how a real model would move

Page 5: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

The Spacetime Solution

Represent motion as a set of equations Set constraints to represent physical

forces and goals (e.g. start at Pi, end at Pf) Optimize solution with respect to some

objective (e.g. minimize force)

Page 6: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Propelled Particle Example

We want to animate a particle that is affected by gravity and has “jet” propulsion force that can propel it

We want to be able to specify a starting position and ending position and want a program to figure out how to propel itself so that it uses the least amount of energy

Page 7: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Basic Terminology

Governing Equation Particle affected by gravity and a “jet” forceBoundary Conditions Given start and end positionObjective Function Minimize consumed energy

Page 8: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Translate to Continuous FunctionsGoverning Equation (affected by gravity and propulsion force function)

Boundary Conditions (given start and end position)

Objective Function (minimize consumed energy)

0)( mgtfxm

atx )( 0 btx )( 1

1

0

2)(

t

t

dttfR

Page 9: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Translate to Discrete Functions

We want to represent x(t) and f(t) as a set of independent variables that we can solve for

Do this by discretizing x(t) and f(t) into n + 1 samples with h step size

Then translate all other equations

etcxhxxhxxx

ffftf

xxxtx

n

n

,)2(,)(,)0(

,...,)(

,...,)(

210

10

10

Page 10: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Discretizing the Governing Equation

Translate

New Governing Equation

x

h

xxx iii

1

211

11

1

2

h

xxxx

hhxx

hxx

x

h

xxx

iiii

iiii

i

iii

02

211

mgfh

xxxm i

iii

Page 11: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Discretizing the Rest Boundary Conditions

Objective Function0

00

0

bx

bx

ax

ax

n

n

atx )( 0

btx )( 1

n

i

t

t

fhdttfR22

1

0

)(

Page 12: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Goal

Find values for f0, f1, … fn that minimizes R while adhering to constraints Do this by finding f values where

0,...0,010

nf

R

f

R

f

R

Page 13: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Sequential Quadratic Programming“Essentially, the method computes a second-

order Newton-Raphson step in R, and a first-order Newton-Raphson step in the (constraint functions), and combines the two steps by projecting the first onto the null space of the second (that is, onto the hyperplane for which all the [constraint functions] are constant to first order)”

Page 14: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Newton-Raphson Method

An iterative process used to attempt to converge on a root of an function given the function and its derivative

Start with a guess, call it x0

We converge on the answer by finding

source: http://www.shodor.org/UNChem/math/newton/index.html

)('

)(1

n

nnn xf

xfxx

Page 15: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Example

60 x

source: http://www.shodor.org/UNChem/math/newton/index.html

xxf

xxf

2)(

04)( 2

So let’s say we’re trying to find one root of

We then guess at a value

Then begin iterating…

Page 16: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Example cont’d

xn f(xn) f’(xn) dx xn-dx

x0 6 32 12 2.67 3.33

x1 3.33 7.09 6.66 1.06 2.27

x2 2.27 1.15 4.54 0.26 2.01

x3 2.01 0.04 4.02 .01 2.00

x4 2.00 0 4.00 0 2.00

source: http://www.shodor.org/UNChem/math/newton/index.html

Page 17: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Graphical Representation

source: http://www.shodor.org/UNChem/math/newton/index.html

Page 18: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Graphical Representation

source: http://www.shodor.org/UNChem/math/newton/index.html

Page 19: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Graphical Representation

source: http://www.shodor.org/UNChem/math/newton/index.html

Page 20: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

NR Graphical Representation

source: http://www.shodor.org/UNChem/math/newton/index.html

Page 21: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

SQP and NR With SQP we are performing the Newton-

Raphson method on our constraint functions and our objective function

Assuming our system is not over-constrained we should be able to get close

0)(,0

ii

SCS

R

Page 22: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

The SQP Notation Represent each guess as Si, a vector of all

independent parameters at each iteration

Turn all of the boundary conditions into constraint functions, call the set of them C

C(S) and R(S) must equal 0 so we can use NR

),...,,,,...,,( 1010 nni fffxxxS

2100 ,, CbxCaxC n

0)(,0)( SRSCi

mgfh

xxxm i

iii

211 2

Page 23: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 1: Second Order NR on R

For now, ignore constraints Start with an initial guess S0

Find Hessian of objective function (do once)

In our example:ji

ij SS

RH

2

otherwisejiff

R

ji

,0,,22

Page 24: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 1 Continued

Recall Taylor expansion

With our equation:

We know that

...))(()()( ' axafafxf

...)()( 020

2

0

SSS

RS

S

R

S

R

0S

R

Page 25: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 1 Continued

Our new equation becomes

We can calculate and solve for (S - S0)

S - S0 is the difference between the actual solution (root) and S0

Because our Taylor series expansion is not complete (i.e. infinite), the value that we actually get is only an approximation of (S - S0)

))(()(0 000 SSSHSS

Rij

)( 0SS

R

Page 26: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 1 Continued

Adding our approximation of (S - S0) (call it ΔS) to our current guess S0 should bring us closer to the actual solution

True to the Newton Raphson method, our new guess at the end of this iteration is

This new “S1” ignores our constraint conditions

SSS 01

Page 27: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 2: First Order NR on C

If Ci(S1) = 0 for all constraint functions we are done

Otherwise, we must similarly converge onto an S value that will make C(S)=0

Find the Jacobian of each Ci

Use Taylor Expansion on each Ci

...)()()( 11

1

SSS

CSCSC i

ii

Page 28: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Step 2 Continued

We rewrite it in terms of the Jacobian and set C(S)=0

Once again, we solve for (S - S1) which is again an approximation that we can call ΔS

After this iteration, our new guess becomes

))(()(0 111 SSSJSCi

SSS 12

Page 29: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Iterating

This new S2 value is fed back into Step 1

The process repeats until C(Sx)=0 and any further decrease in R requires violating the constraints

Page 30: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Graphical Explanation of SQP

S0 S1’

S1S2’ S2

C(S)

S

R

S

Slide taken from http://www.cs.virginia.edu/~gfx/courses/2005/Animation.spring.05/

Page 31: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Using constraints to animate Luxo

Define the model and its laws of motion Set constraints for desired result Choose a criteria and optimize solution

Page 32: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Define model

Define model: Four rigid massive links

Derive laws of motion

“Muscles”: Three springs produce arbitrary time-dependent joint forces

Page 33: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Constraints

Initial and final positions and poses No motion in contact with floor (simulates

inelastic collision)

Page 34: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Solving Set optimization

criteriaMinimize applied

muscle power (muscle force times angular velocity)

Page 35: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Adding different constraints

Landing force

Height of jump

Page 36: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Increase mass

Page 37: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Ski Jump Added Constraints:

Base tangent to surface Height of base in air at one time step

Optimization includes “style”

Removed Constraints: Base free to slide Initial velocity

Page 38: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

More about Spacetime

Original paper by Witkins and Kass written in 1988

A number of applications and further optimizations studied since

Page 39: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

“Spacetime Constraints Revisited” J. Thomas Ngo, Harvard,

Joe Marks, Cambridge 1993

Instead of using perturbational analysis, use global search to find optimal solution

Generate possible solutions and use a genetic search algorithm to find the best

source: http://citeseer.ist.psu.edu/cache/papers/cs/1776/http:zSzzSzwww.merl.comzSzpeoplezSzmarkszSzspacetime.pdf/ngo93spacetime.pdf

Page 40: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Human Motion with Spacetime Constraints Charles Rose, Brian Guenter,

Bobby Bodenheimer, Michael Cohen, Microsoft Research 1996

Using Inverse Kinematics and Spacetime Constraints, the Microsoft team was able to simulate realistic human motion with 44 degrees of freedom

Biggest problem: with so many degrees of freedom and so many constraints, difficult to do quickly

source: http://research.microsoft.com/~cohen/EfficientSIG96.pdf

Page 41: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Human Motion with Spacetime Constraints

source: http://research.microsoft.com/~cohen/EfficientSIG96.pdf

Page 42: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Motion Editing with Spacetime Constraints Michael Gleicher, Apple Research Laboratories

1997 Summary

Given an animation, allow the animator to use direct manipulation to edit any joint in any time step and, using spacetime constraints, a program figures out, in real time, what the new animation will be, attempting to mimic the style of the original as best as possible

source: http://www.cs.wisc.edu/graphics/Papers/Gleicher/California/SpacetimeEditing.pdf

Page 43: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Motion Editing with Spacetime Constraints “Best” or optimal motion is one

where as much of the style is preserved as possible Animator can specify what parts

of the animation she wants to preserve

Uses spacetime techniques to propagate changes across entire animation

source: http://www.cs.wisc.edu/graphics/Papers/Gleicher/California/SpacetimeEditing.pdf

Page 44: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Spacetime Constraints for Biomechanical Movements David Brogan, Kevin

Granata, Pradip Sheth, University of Virginia, 2002

Use the Spacetime method to see how pathological constraints can affect movement

source: http://www.cs.virginia.edu/~dbrogan/Publications/Papers/iasted02.pdf

Page 45: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Arm Motion with Spacetime Constraints Dengming Zhu, Zhaoqi Wang, He Huang,

Min Shi, Chinese Academy of Sciences 2003

Simulate natural arm movement using Spacetime Constraints

source: http://vh.ict.ac.cn/news/upload/2003Arm.doc

Page 46: Spacetime Constraints David Coyne Joe Ishikura. The challenge of kinematics Successful animation requires control, but looks real Traditional principles.

Questions?