Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

27
Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo

Transcript of Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Page 1: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Spacetime Constraints

Andrew WitkinMichael Kass

Presenter: Fayun Luo

Page 2: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Outline

• Introduction and Motivation

• A Particle Example

• SQP Method

• Extension to Complex Models

• Discussion

• A Tiny Movie Demo

Page 3: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Early Computer Simulations

Question: can we generate those motion automatically?

The first computer generated simulation—Pixar’s Luxo, Jr. 1986

Yes, by adding physics in the simulation.

Page 4: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Physically-based Approaches

Solving Initial Value Problems

V0

x0 x1

Page 5: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Physically-based ApproachesConstraints force methods

A man executing a kickA man executing a kick

The same kick on a frictionless floor

Page 6: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Physically-based Approaches

Spacetime Constraints

Basic idea is solve for the character’s motion and varying force over the entire time.

Newtonian physics

Object Function

Page 7: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Roadmap

• Introduction and MotivationIntroduction and Motivation

• A Particle Example

• SQP MethodSQP Method

• Extension to Complex ModelsExtension to Complex Models

• DiscussionDiscussion

• A Tiny Movie DemoA Tiny Movie Demo

Page 8: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Problem Statement

0 mgfxm

dttfRT

0

2|)(|

bTxax )(,)0(

Governing Equation (Motion Equation):

Object Function (Energy Consumption):

Boundary Conditions:

gf(t)

Page 9: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Discretize continuous function

1n

i

Discretize unknown function x(t) and f(t) as:

x1, x2, …xi, … xn-1, xn

f1, f2, …fi, … fn-1, fn

Our goal is to solve these discretized 2n values.

Next step is to dicretize our motion equation and object equation.

Page 10: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Difference Formula

h

xx

h

xx

h

xxx iiiiiii 2

1111

xi - 1 xi xi + 1

xi - 0.5 xi + 0.5

h h

211

11

5.05.0 2

h

xxx

hh

xx

h

xx

h

xxx iii

iiii

iii

Backward Forward Middle

Middle

Page 11: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Discretized Function

3,2,0)2(

0

112

imgfxxxh

m

mgfxm

iiii

bxbTx

axax

4

1

)(

)0(

t

x

x1, f1

x2, f2

x3, f3x4, f4

Motion equation:

Boundary Conditions:

24

1

0

2

||

|)(|

ii

T

fR

dttfR

Object Function: When does R have minimum value?

0000

0

4321

f

R

f

R

f

R

f

R

f

R

i

Page 12: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Roadmap

• Introduction and MotivationIntroduction and Motivation

• A Particle ExampleA Particle Example

• SQP Method

• Extension to Complex ModelsExtension to Complex Models

• DiscussionDiscussion

• A Tiny Movie DemoA Tiny Movie Demo

Page 13: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Generalize Our Notation

0S

R

3,2,0)2( 112 imgfxxx

h

miiii

bxax 41

t

x

x1, f1

x2, f2

x3, f3

x4, f4

Unknown vector:

S = (S1, S2, …Sn)

Constraint Functions:

Ci(S) = 0

Object Function R(S):

0000

0000

4321

4321

f

R

f

R

f

R

f

R

x

R

x

R

x

R

x

R S = (x1, x2, x3, x4, f1, f2, f3, f4)

j

iij S

CJ

jiij SS

RH

2

Page 14: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

SQP Step One

S

R

0S

R

))(())((!2

1))(()()( 22''' axOaxafaxafafxf

Pick a guess S0, evaluate

Taylor series expansion of function f(x) at point a is:

))(()( 2002

2

00

SSOSSS

R

S

R

S

R

SSSS

'100

00 ))((0

SSSSorSSS

SSSHS

Rij

SS

Most likely

Similarly, we have:

= 0 Omit

Page 15: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

SQP Step Two

))(()()()( 2'1

'1

'1

'1

SSOSSS

CSCSC

SS

SSSSSSorSSS

SSSJSC ij

0'1

'1

'1

'1

'1 ))(()(

Now we got S1’, evaluate our constraints Ci(S1

’), if equal to 0, we are done but most likely it will not evaluate to 0 in the first several steps.

So, let’s say Ci(S1’) ≠ 0, let’s apply Taylor series expansion on

the constraint function Ci(S) at point S1’ :

1001 SSsoSSSS

Then we will continue with step one and step two until we got a solution Sn which minimize our object function and also satisfy our constraints.

= 0 Omit

S0 S1’ S1 S2

’ S2 … Sn

Page 16: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Graphical Explanation of SQP

S0 S1’

S1S2’ S2

C(S)S

R

S

Page 17: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Roadmap

• Introduction and MotivationIntroduction and Motivation

• A Particle ExampleA Particle Example

• SQP MethodSQP Method

• Extension to Complex Models

• DiscussionDiscussion

• A Tiny Movie DemoA Tiny Movie Demo

Page 18: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Difficulties

• Set up the motion equations

• Define the objective equation

• Evaluate the derivatives

• Fit them into our SQP solver

Page 19: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Derive Motion EquationUse Lagrangian Dynamics to derive our motion equations dynamically:

0)(

Qq

T

q

T

dt

d

T – Kinetic Energy

q – Generalized Coordinates

Q – Generalized Forces

Page 20: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

The Authors’ Automatic System

Graphical User Interface

Function Boxes Dynamic System

SQP Solver

T, Q, q J

R H

Page 21: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Roadmap

• Introduction and MotivationIntroduction and Motivation

• A Particle ExampleA Particle Example

• SQP MethodSQP Method

• Extension to Complex ModelsExtension to Complex Models

• Discussion

• A Tiny Movie DemoA Tiny Movie Demo

Page 22: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Lagrangian Dynamics

0)(

Qq

T

q

T

dt

d

Define T for complex system is still too much work.

Page 23: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Define Objective Functions

• Walking on hot coals

• Walking on eggs

• Carrying a bowl of hot soup

• Pursued by a bear

Define appropriate objective functions may be extremely difficult:

Page 24: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

The Author’s Automatic System

Symbolic Analysis is really complex, especially for complex system.

The state of art symbolic analysis tool is Matlab, Maple.

The author’s automatic system may work for some relative simple system.

Page 25: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Local Optimization vs Global Optimization

S

R

S0 S* S*

Page 26: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

Roadmap

• Introduction and MotivationIntroduction and Motivation

• A Particle ExampleA Particle Example

• SQP MethodSQP Method

• Extension to Complex ModelsExtension to Complex Models

• DiscussionDiscussion

• A Tiny Movie Demo

Page 27: Spacetime Constraints Andrew Witkin Michael Kass Presenter: Fayun Luo.

References

• Pixar, Luxo, Jr. 1986• Ronen Barzel, et al. Dynamic Constraints.

Siggraph 1987• Paul Issacs and Michael Cohen, Controlling

Dynamic Simulation with Kinematic Constraints, Proc. Siggraph 1987

• David C. Brogan, et al. Spacetime Constraints for Biomechanical Movements. Applied Modeling and Simulation, 2002

• Phillip Gill, et al. Practical Optimization, Academic Press, New York, NY, 1981