300 likes | 393 Views
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
E N D
Spacetime Constraints Andrew WitkinMichael 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
Roadmap • A Particle Example • SQP Method • Extension to Complex Models • Discussion • A Tiny Movie Demo
Problem Statement Governing Equation (Motion Equation): Boundary Conditions: f(t) g Object Function (Energy Consumption):
Discretize continuous function 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… x1xn satisfies goals while optimizing f1fn Next step is to discretize our motion equation and object equation. i 1 n
Difference Formula h h xi - 0.5 xi + 0.5 xi - 1 xi xi + 1 Backward Forward Middle Middle
Discretized Function Motion equation: x x4, f4 x3, f3 x2, f2 Boundary Conditions: x1, f1 t Object Function: When does R have minimum value?
Roadmap • A Particle Example • SQP Method • Extension to Complex Models • Discussion • A Tiny Movie Demo
Generalize Our Notation Unknown vector: S = (S1, S2, …Sn) x x4, f4 Constraint Functions: Ci(S) = 0 x3, f3 x2, f2 x1, f1 Minimize Object Function R(S): t S = (x1, x2, x3, x4, f1, f2, f3, f4)
Sequential Quadratic Programming (SQP) Step One Pick a guess S0, evaluate Most likely Taylor series expansion of function f(x) at point a is: Similarly, we have: Set equal to 0 Omit Sa 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’ : Omit Set equal to 0 Sb is the change to S0 that makes 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 C(S) S1 S2’ S2 S S0 S1’
Roadmap • 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: T – Kinetic Energy q – Generalized Coordinates Q – Generalized Forces
The Authors’ Automatic System Graphical User Interface T, Q, q J Dynamic System SQP Solver Function Boxes R H
Roadmap • A Particle Example • SQP Method • Extension to Complex Models • Discussion • A Tiny Movie Demo
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:
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
Roadmap • A Particle Example • SQP Method • Extension to Complex Models • Discussion • A Tiny Movie Demo