# Spacetime Constraints

Document Sample

```					Spacetime Constraints

Andrew Witkin
Michael Kass
Early Computer Animations
Pixar’s Luxo, Jr. 1986

Can we generate those motions automatically?
Some Context
• What have we learned about animation?
– Forward simulation is possible
• Assignment 1 and Timewarp paper
– Constraints can be met
• Inverse Kinematics
• Monte Carlo
– Sampling Plausible Solutions…
• Constrained optimization
– Through the Lens
Forward Simulation
• Given initial state and equations defining
changes in state…

– Integrate (simulate)

• Rigid body simulations, collisions,
kinematic chains, brittle fracture, cloth,
water, gas molecules
Meeting Constraints
• Inverse Kinematics
– The end-effector must reach a desired point
• Linearize (using the Jacobian)
• Subdivide (linear model fails quickly)

– Iterative technique with an animation that is
not guaranteed to be optimal in any sense
• Bad decisions in beginning are offset at the end
Meeting Constraints
• Monte Carlo
– A random initial value, followed by simulation,
will not likely lead to constraint-satisfying outputs
• Random exploration of initial values will take too long
• Guided exploration of initial values is feasible
– Identifying the initial values to change and how
much to change them is nontrivial
– Benefits greatly from orthogonality of inputs and
locality of good solutions
Meeting Constraints
• Through the Lens
– Like IK, but equations are a bit more general
– Iterative
– Local linearizations
– Constrained optimization
• Minimize camera movement subject to a specific
velocity of the projection of a point on world space
to screen space
• Lagrangian kicked in to balance between violating
constraints and increasing camera movement
Spacetime Constraints
• We have a physical simulation that can be
driven as an initial-value problem
– Given a sequence of torques that are applied
to a bicyclist, we can simulate its final path

• We don’t have the inverse
– Given a sequence of landmarks, compute the
torques required to make a bicyclist ride
through them… make the torques “optimal”
Spacetime Constraints
• Given a sequence of landmarks, compute
the torques required to make a bicyclist
ride through them… make the torques
“optimal”
– One could propose trajectories that go
through landmarks but require unreasonable
amounts of energy
– One could propose low-energy trajectories
that don’t go through landmarks
Spacetime Constraints
• Balancing between constraint satisfaction
(in space) and evaluation function
minimization (in time) is the key!

• Globally optimal solutions are once again
impossible to find, so a good local method
is proposed
•   A Particle Example
•   SQP Method
•   Extension to Complex Models
•   Discussion
•   A Tiny Movie Demo
Problem Statement
Governing Equation (Motion Equation):

m  f  mg  0
x

Boundary Conditions:

f(t)                 x(0)  a, x(T )  b
g

Object Function (Energy Consumption):
T
R   | f (t ) |2 dt
0
Discretize continuous function

Discretize unknown function x(t) and
f(t) as:
x1, x2, …xi, … xn-1, xn
1       i                  f1, f2, …fi, … fn-1, fn
n
Our goal is to solve these discretized
2n values… x1xn satisfies goals
while optimizing f1fn
Next step is to discretize our motion
equation and object equation.
Difference Formula
h              h

xi - 0.5        xi + 0.5

xi - 1              xi              xi + 1

xi  xi 1 xi 1  xi xi 1  xi 1
xi 
                        
h           h          2h
Backward             Forward           Middle

xi 1  xi xi  xi 1

xi 0.5  xi 0.5
                         h         h       x  2 xi  xi 1
i 
x                                                 i 1
h                       h                  h2

Middle
Discretized Function
Motion equation:
x                                                    m  f  mg  0 
x
m
x3, f3   x4, f4            ( xi 1  2 xi  xi 1 )  f i  mg  0, i  2, 3
h2
x2, f2
Boundary Conditions:
x1, f1                                           x(0)  a  x1  a
t            x(T )  b  x4  b

Object Function:                        When does R have minimum value?
T
R   | f (t ) |2 dt                   R
0
0
f i
4
R   | f i |2                          R     R      R      R
0      0      0      0
i 1
f1    f 2    f 3    f 4
•   A Particle Example
•   SQP Method
•   Extension to Complex Models
•   Discussion
•   A Tiny Movie Demo
Generalize Our Notation
Unknown vector:

x                                                       S = (S1, S2, …Sn)

x4, f4        Constraint Functions:
x3, f3                                                               Ci
x2, f2                                    Ci(S) = 0                  J ij 
S j
x1, f1                                      Minimize Object Function R(S):
t                 R                                2R
0                     H ij 
S                               Si S j

S = (x1, x2, x3, x4, f1, f2, f3, f4)
R     R     R     R
0     0     0     0
m                                                          x1    x2    x3    x4
2
( xi 1  2 xi  xi 1 )  f i  mg  0, i  2, 3
h                                                          R     R      R      R
0      0      0      0
x1  a        x4  b                                       f1    f 2    f 3    f 4
(SQP) Step One
R                                       R
Pick a guess S0, evaluate                                  Most likely             0
S                                       S
Taylor series expansion of function f(x) at point a is:
1 ''
f ( x)  f (a)  f ' (a)(x  a)        f (a)(x  a) 2  O((x  a) 2 )
2!

Similarly, we have:          R R        2R
          2                          ( S  S0 )  O((S  S 0 ) 2 )
S S S  S0 S                 S  S0
Set equal to 0                                                                                Omit
R
                  H ij ( S 0 )(S  S 0 ) 
S   S  S0

S  S 0  S           or    S  S 0  S  S1'

S is the change to S0 that makes
derivative equal to 0
SQP Step Two
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’ :
C
C ( S )  C ( S1' )                  ( S  S1' )  O((S  S1' ) 2 )
S   S  S1
'

Omit
Set equal to 0      C ( S1' )  J ij ( S1' )( S  S1' ) 
S  S1'  S       or     S  S1'  S   S 0  S  S 

S is the change to S0 that makes
S1  S 0  S  S           so       S 0  S1
derivative equal to 0
Then we will continue with step one and step two until we got a solution
Sn which minimizes our object function and also satisfies our constraints.

S0  S1’  S1  S2’  S2  …  Sn
Graphical Explanation of SQP

R                       C(S)
S

S2’   S2    S1
S
S0   S1   ’
•   A Particle Example
•   SQP Method
•   Extension to Complex Models
•   Discussion
•   A Tiny Movie Demo
Difficulties
•   Set up the motion equations
•   Define the objective equation
•   Evaluate the derivatives
•   Fit them into our SQP solver
Derive Motion Equation
Use Lagrangian Dynamics (another use of
Lagrangian) to derive our motion equations
dynamically:
d T   T
( )    Q  0
dt q
  q
T – Kinetic Energy
q – Generalized Coordinates
Q – Generalized Forces
The Authors’ Automatic System
Graphical User Interface

T, Q, q      J

Function Boxes             Dynamic           SQP
System           Solver
R         H
•   A Particle Example
•   SQP Method
•   Extension to Complex Models
•   Discussion
•   A Tiny Movie Demo
Define Objective Functions
Define appropriate objective functions
may be extremely difficult:
•   Walking on hot coals
•   Walking on eggs
•   Carrying a bowl of hot soup
•   Pursued by a bear
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 relatively simple systems.
Local Optimization vs Global
Optimization
R

S0 S*   S*        S
•   A Particle Example
•   SQP Method
•   Extension to Complex Models
•   Discussion
•   A Tiny Movie Demo

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 2 posted: 8/26/2012 language: English pages: 29