Spacetime Constraints

Download Report

Transcript Spacetime Constraints

Spacetime
Constraints
David Coyne
Joe Ishikura
The challenge of kinematics
Successful animation
requires control, but looks
real
 Traditional principles of
animation look “right”

Problem
Control
Keyframe animation



Artist controls each
pose
Time consuming
Takes an expert to
make it look good
Accuracy
Physics simulations


Looks realistic
Almost no kinematic
control
 Forward simulation
using timedependent force
functions looks bad
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

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)

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
Basic Terminology
Governing Equation
 Particle affected by gravity and a “jet” force
Boundary Conditions
 Given start and end position
Objective Function
 Minimize consumed energy
Translate to Continuous Functions
Governing Equation (affected by gravity and propulsion force function)
mx  f (t )  m g  0
Boundary Conditions (given start and end position)
x(t0 )  a x(t1 )  b
Objective Function (minimize consumed energy)
t1
R   f (t ) dt
t0
2
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
x(t )  x0 , x1 ,...xn
f (t )  f 0 , f1 ,... f n
x(0)  x0 , x(h)  x1 , x(2h)  x2 , etc

Then translate all other equations
Discretizing the Governing Equation

Translate
x
xi  xi 1
h
xi 1  xi xi  xi 1

h
h
xi 
h
xi 1  2 xi  xi 1
xi 
h2
xi 
xi  xi 1
xi 
h

New Governing Equation
xi 1  2 xi  xi 1
m
 f i  mg  0
2
h
Discretizing the Rest

Boundary Conditions
x(t0 )  a  x0  a
x0  a  0
x(t1 )  b  xn  b
xn  b  0

Objective Function
t1
R   f (t ) dt  h f i
t0
2
n
2
Goal

Find values for f0, f1, … fn that minimizes R while
adhering to constraints
 Do
this by finding f values where
R
R
R
 0,
 0,...
0
f 0
f1
f n
Sequential Quadratic Programming
“Essentially, the method computes a secondorder Newton-Raphson step in R, and a firstorder 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)”
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
xn 1
f ( xn )
 xn 
f ' ( xn )
source: http://www.shodor.org/UNChem/math/newton/index.html
NR Example

So let’s say we’re trying to find one root of
f ( x)  x 2  4  0
f ( x)  2 x

We then guess at a value
x0  6

Then begin iterating…
source: http://www.shodor.org/UNChem/math/newton/index.html
NR Example cont’d
x0
x1
x2
x3
x4
xn
6
3.33
2.27
2.01
2.00
f(xn)
32
7.09
1.15
0.04
0
f’(xn)
12
6.66
4.54
4.02
4.00
dx
2.67
1.06
0.26
.01
0
source: http://www.shodor.org/UNChem/math/newton/index.html
xn-dx
3.33
2.27
2.01
2.00
2.00
NR Graphical Representation
source: http://www.shodor.org/UNChem/math/newton/index.html
NR Graphical Representation
source: http://www.shodor.org/UNChem/math/newton/index.html
NR Graphical Representation
source: http://www.shodor.org/UNChem/math/newton/index.html
NR Graphical Representation
source: http://www.shodor.org/UNChem/math/newton/index.html
SQP and NR

With SQP we are performing the NewtonRaphson method on our constraint functions
and our objective function
R
 0, C ( Si )  0
Si

Assuming our system is not over-constrained
we should be able to get close
The SQP Notation

Represent each guess as Si, a vector of all
independent parameters at each iteration
Si  ( x0 , x1 ,...,xn , f 0 , f1 ,..., f n )

Turn all of the boundary conditions into
constraint functions, call the set of them C
C0  x0  a, C1  xn  b, C2 
 C(S)
m
xi 1  2 xi  xi 1
 f i  mg
2
h
and R(S) must equal 0 so we can use NR
Ci (S )  0, R(S )  0
Step 1: Second Order NR on R

For now, ignore constraints
Start with an initial guess S0
Find Hessian of objective function (do once)

2R
H ij 
Si S j
In our example:


2R
 2, i  j,  0, otherwise
f i f j
Step 1 Continued

Recall Taylor expansion
f ( x)  f (a)  f (a)(x  a)  ...
'

With our equation:
R R
2R

( S0 ) 
(S  S0 )  ...
2
S S
S0

R
0
We know that
S
Step 1 Continued

Our new equation becomes

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)
R
0
( S 0 )  H ij ( S 0 )( S  S 0 )
S
R
 We can calculate
( S 0 ) and solve for (S - S0)
S

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
S1  S0  S

This new “S1” ignores our constraint conditions
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
Ci
Ci ( S )  Ci ( S1 ) 
( S  S1 )  ...
S1
Step 2 Continued

We rewrite it in terms of the Jacobian and set
C(S)=0
0  Ci (S1 )  J (S1 )(S  S1 )


Once again, we solve for (S - S1) which is again
an approximation that we can call ΔS
After this iteration, our new guess becomes
S2  S1  S
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

Graphical Explanation of SQP
C(S)
R
S
S2’
S0
S1
S2
’
Slide taken from http://www.cs.virginia.edu/~gfx/courses/2005/Animation.spring.05/
S1
S
Using constraints to animate Luxo
Define the model and its laws of motion
 Set constraints for desired result
 Choose a criteria and optimize solution

Define model
Define model:
 Four rigid massive links

 Derive

laws of motion
“Muscles”: Three springs
produce arbitrary timedependent joint forces
Constraints
Initial and final positions and poses
 No motion in contact with floor (simulates
inelastic collision)

Solving

Set optimization
criteria
 Minimize
applied
muscle power
(muscle force times
angular velocity)
Adding different constraints

Landing force

Height of jump

Increase mass
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
More about Spacetime
Original paper by Witkins and Kass written
in 1988
 A number of applications and further
optimizations studied since

“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
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
Human Motion with Spacetime
Constraints
source: http://research.microsoft.com/~cohen/EfficientSIG96.pdf
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
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
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
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
Questions?