<<

Constraints

Andrew Witkin

Schlumberger Palo Alto Research 3340 Hillview Avenue, Palo Alto, CA 94304

Abstract Siggraph '87 [9]. Although Luxo, Jr. showed us that the team of animator, keyframe system, and renderer can be Spacetime constraints are a new method for creating char- a powerful one, the responsibility for de®ning the acter animation. The animator speci®es what the character remains almost entirely with the animator. has to do, for instance, ªjump from here to there, clearing a Some aspects of animationÐpersonalityand appeal, for hurdle in between;º how the motion should be performed, exampleÐwill surely be left to the animator's artistry and for instance ªdon't waste energy,º or ªcome down hard skill for a long time to come. However, many of the prin- enough to splatter whatever you land on;º the character's ciples of animation are concerned with making the charac- physical structureÐthe , mass, connectivity, etc. ter's motionlook real at a basic mechanical level that ought of the parts; and the physical resources available to the to admit to formal physical treatment. Consider for exam- character to accomplish the motion, for instance the char- ple a jump exhibitinganticipation,squash-and-stretch, and acter's muscles, a ¯oor to push off from, etc. The require- follow-through. Any creatureÐhuman or lampÐcan only ments contained in this description, together with New- accelerate its own center of mass by pushing on something ton's laws, comprise a problem of constrained optimiza- else. In jumping, the opportunity to control acceleration tion. The solution to this problem is a physically valid mo- only exists during contact with the ¯oor, because while tion satisfying the ªwhatº constraints and optimizing the airborne there is nothing to push on. Anticipation prior to ªhowº criteria. We present as examples a Luxo lamp per- takeoff is the phase in which the needed momentum is ac- forming a variety of coordinated . These realistic quired by squashing then stretching to push off against the motions conform to such principles of traditional anima- ¯oor. Follow-throughis the phase in which themomentum tion as anticipation, squash-and-stretch, follow-through, on landing is absorbed. and timing. Such physical arguments make nice post hoc explana- tions, but can physics be brought to bear in creating the Keywords Ð Animation, Constraints complex active motions of characters like Luxo? If so, how much of what we regard as ªniceº motion follows 1 Introduction directly from ®rst principles, and how much is really a matter of style and convention? Computer animation has made enormous strides in the past This paper presents a physically-based approach to char- several years. In particular, 's Luxo, Jr. [10] marked acter animation in which coordinated, active motion is a turning point as perhaps the ®rst computer-generated created automatically by specifying: work to compete seriously with works of traditional ani-

 What the character has to do, for instance ªjump from mation on every front. Key among the reasons for Luxo, here to there.º Jr.'s success is that it was made by a talented animator who adapted the principles of traditional animation to the  How the motion should be performed, for instance computer medium. Luxo, Jr., in large measure, is awork ªdon't waste energy,º or ªcome down hard enough to of traditional animation that happens to use a computer splatter whatever you land on.º to render and to interpolate between keyframes. John

Lasseter spelled this out clearly in his presentation to  What the character's physical structure isÐwhat the pieces are shaped like, what they weigh, how they're connected, etc.

0ªLuxoº is a trademark of Jac Jacobsen Industries AS.

1  What physical resources are available to the character the objects end up and how they get there as where they to accomplish the desired motion, for instance the begin. Problems cast in this form are not initialvalue prob- character's muscles (or whatever an animate lamp lems. For instance, while simulating a bouncing ball is has in place of muscles,) a ¯oor to push off from, etc. easy enough, making the ball bounce to a particular place requires choosing just the right starting values for posi- Our initial experiments with this approach have aimed tion, velocity, and spin. Making these choices manually is at making a Luxo lamp execute a convincing jump just a painful matter of trial and error. Problems such as this by telling it where to start and where to end. The re- one, in which both initial and ®nal conditions are partially sults we present in this paper show that such properties or completely constrained, are called two-point boundary as anticipation, follow-through, squash-and-stretch, and problems, requiring more elaborate solution methods than timing indeed emerge from a bare description of the mo- forward simulation.[3] tion's purpose and the physical context in which it occurs. Character animation poses a still more dif®cult problem. Moreover, simple changes to the goals of the motion or Animals move by using their muscles to exert forces that to the physical model give rise to interesting variations on vary as a function of time. Calculating the motion by the basic motion. For example, doubling (or quadrupling) simulation is straightforward once these time-dependent the mass of Luxo's base creates amusingly exaggerated force functions are known, but the dif®cult problem is motion in which the base looks heavy. to calculate force functions that achieve the goals of the Our method entails the numerical solution of large con- motion. Specifying these functions by hand would be strained optimization problems, for which a variety of hopeless, equivalent to making a robot move gracefully standard algorithms exist. These algorithms, while rela- by manually varying its motor torques. tively expensive, spend most of their time solving sparse In an effort to reconcile the advantages of simulation linear systems, and are therefore amenable to accelera- with the need for control, several researchers [1, 7] have tion by array processors and other commonly available proposed methods for blending positional constraints with hardware. The greatest dif®culty arises not in comput- dynamic simulations. The idea behind these methods is ing the numerical solution, but in setting up the intricate to treat kinematic constraints as the consequences of un- sparse matrix equations that drive the solution process. To known ªconstraint forces,º solve for the forces, then add address this problem we implemented an object-oriented them intothesimulation,exactly canceling that component symbolic algebra system that automates this dif®cult task of the applied forces that ®ghts against the constraints. almost entirely. We therefore believe the method described Constraint force methods permit parts, such as a char- here can become a practical animation tool requiring no acter's hands or feet, to be moved along prede®ned more mathematical sophistication of the end user than do keyframed trajectories, but provide no help in de®ning current keyframing systems. the trajectories, which is the central problem in creat- The remainder of the paper is organized as follows: the ing character animation. While allowing a character to following section discusses the previous use of physical be dragged around manually like a marionette, constraint methods in animation. The spacetime method is then in- forces sidestep the central issue of deciding how the char- troduced using a moving particle as a toy example. Next, acter should move. our extension of the method to complex problems is dis- These shortcomingsled us to adopt a new formulationof cussed. Finally, the Luxo model and the results obtained the constraint problem, whose central characteristic is that with it are described. we solve for the character's motion and time-varying mus- cle forces over the entire time interval of interest, rather 2 Background and Motivation than progressing sequentially through time. Because we extend the model through time as well as , we call Recently, there has been considerable interest in incorpo- the formulation spacetime constraints. rating physics into animation using simulation methods. The spacetime formulation permits the imposition of [7, 14, 15, 1, 13, 4, 6] The appeal of physical simulation as constraints throughout the time course of the motion, with an animation technique lies in its promise to produce real- the effects of constraints propagating freely backward as istic motion automatically by applying the same physical well as forward in time. Constraints on initial, ®nal, or laws that govern real objects' behavior. intermediate positions and velocities directly encode the Unfortunately, the realism of simulation comes at the goals of the motion, while constraints limiting muscle expense of control. Simulation methods solve initialvalue forces or preventing interpenetration de®ne properties of problems: the course of a simulation is completely deter- the physical situation. Additionally, Newtonian physics mined by the objects' initial positions and velocities, and provides a constraint relating the force and position func- by the forces applied to the objects along the way. An ani- tions that must hold at every instant in time. Subject mator, however, is usually concerned as much with where to these constraints we optimize functions that specify

2

how the motion should be performed, in terms of ef®- (see [12] for a good survey.) We choose instead to rep-

(t) f (t) ciency, smoothness, etc. Solving this constrained opti- resent the functions x and independently. The mization problem yields optimal, physically valid motion equation of motion then enters as a constraint that relates that achieves the goals speci®ed by the animator. the two functions, to be satis®ed along with the other constraints during the solution process. Each function is discretized, that is, represented as a sequence of values, 3 A spacetime particle with time derivatives approximated by ®nite differences. This approach leads to a classical problem in constrained As a gentle but concrete introduction to the spacetime optimization, for which a variety of standard solution al- method, this section describes a minimal example involv- gorithms are available.

ing a moving particle, in¯uenced by gravity, and equipped

(t) f (t) Let the discretized functions x and be repre-

with a ªjet engineº as a means of locomotion. With no

x f  i  n i sented by sequences of values i and ,0 , restrictions on the forces exerted by its engine, the particle with h the time interval between samples. To approximate

can move any way it likes. The problem we formulate

(t) the time derivatives of x we use the ®nite difference here is that of making the particle ¯y from a given start- formulas

ing point to a given destination in a ®xed period of time,

x x

i

with minimal fuel consumption. This toy problem is too i 1

_

x =

i (2)

simple to produce any really interesting motion, but it ex- h

x x + x

i+ i

hibits all the key elements of the method, and will aid in 1 2 i 1



x = i 2 (3) understanding what follows. h

Substituting these relations into equation 1 gives n

x f i

3.1 Problem formulation ªphysics constraintsº relating the i 's to the 's,

x(t)

x x + x

+ i i

Let the particle's position as a function of time be , i 1 2 1

p = m f mg = ;

i 0 1

(t) f 2

and the time-varying jet force be . Suppose for sim- h ) plicity that the mass of the fuel is negligible compared to (4

that of the particle, so the total mass may be treated as a In addition we have the two boundary constraints

mg

constant, m, with a constant gravitational force .Then

c = x a = the particle's equation of motion is a 1 0

and



x f mg = ; ( )

m 0 1

c = x b = : n

b 0 

where x is the second time derivative of position. Given

(t)

Assuming that f is constant between samples, the ob-

_

(t) x x the function f , and initial values for and at some

jective function R becomes a sum

x(t) t time t0, the motion from 0 could be obtained by

integrating equation 1 to solve the initial value problem. X 2

R = h jf j ( )

i 5

Instead we wish to make the particle ¯y from a known

i b point a to a known point in a ®xed period of time. Suppose for simplicity that the rate of fuel consumption which is to be minimized subject to the constraints. The

2 discretized objective and constraint functions are now ex- f j x(t )= a

is j . In that case, we have constraints 0 and

x f i

pressed in terms of the i (t )=b x 1 subject to which 's and the 's, which are the

independent variables to be solved for. Z

t1

2

R = jf (t)j dt

t0 3.2 Numerical Solution

must be minimized. The problem then is to ®nd a force From the standpoint of the numerical solution process it is

(t) (t ;t )

function f , de®ned on the interval 0 1, such that the useful to suppress the structure of the particular problem,

(t)

position function x obtained by solving equation 1 sat- reducing it to a canonical form consisting of a collection of

S ;  j  n

is®es the boundary constraints, and such that the objective scalar independent variables j 1 , an objective

R R(S )

function is a constrained minimum. function j to be minimized, and a collection of scalar

C (S );

There exist a variety of standard approaches to solving constraint functions i 1 , which must be S

problems of this form. Prevalent in the optimal control driven to zero. In the current problem, the j 's are the

x y z x f i

literature are iterative methods that solve the initial value , ,and components of the i 's and the 's, while the

C p c c

i a b problem within each iteration, using the equations of mo- i 's are the components of the 's, ,and . Typically, tion to obtain the position function from the force function setting up the linearized indices is the responsibility of a

3

3

 n O (n ) program that keeps track of the independent variables and Although inverting a general n matrix is , the constraint functions. the matrices arising in spacetime problems are nearly al-

In these terms, the standard constrained optimization ways extremely sparse. Exploiting the sparsity is essen-

S R(S ) j

problem is ªFind j that minimizes subject to tial to make the problem tractable. Moreover, over- and

C (S )= j i 0. For the sake of modularity, the numeri- under-constrained systems, whose matrices are non-square cal method that solves the problem is best regarded as an and/or rank-de®cient, can easily arise, in which case the object that requests answers to certain standard questions inverse is unde®ned and the system cannot be solved. The

about the system, and iteratively provides updated values latter problem is well treated by the pseudo-inverse [8, 4], S

for the solution vector j . Any method must be permitted which provides least-squares solutions to overconstrained

R C S j to request the values of and i at a given . In addi- problems, and minimal solutionsto underconstrainedones.

tion, most effective methods require access to derivatives To compute the pseudo-inverse while exploiting random

R C S j of and i with respect to , in order to move toward a sparsity, we adapted a sparse conjugate gradient (CG)

2

(n ) solution. algorithm described in [11], which is O for typical The solution method we use is a variant of Sequential problems. The CG algorithm solves the matrix equation

2

= Mb ja Mbj Quadratic Programming (SQP), described in detail in [3]. a by iteratively minimizing , giving a

Essentially, the method computes a second-order Newton- least-squares solution to overconstrained problems. Pro- R

Raphson step in , and a ®rst-order Newton-Raphson step vided that a zero starting-point is given for b, the solution

C M in the i 's, and combines the two steps by projecting vector is restricted to the null-space complement of .

the ®rst onto the null space of the second (that is, onto the C hyperplanefor which all the i 's are constant to®rst order.) 3.4 Matrix evaluation. Because it is ®rst-order in the constraint functions and second-order in theobjectivefunction,themethod requires Applying the SQP algorithm to the moving particle exam- that we be able to compute two derivative matrices: the ple requires evaluation of the sparse derivative matrices, Jacobian of the constraint functions, given by as well as the objective and constraint functions them-

selves. Apart from the bookkeeping required for indexing,

@C

i

; J =

ij these evaluations are straightforward. The Jacobian of the @S j physics constraint is given by

and the Hessian of the objective function,

@ p

i 2

m=h ; i = j

2 = 2

@ R

@ x

j

H = :

ij @S

@S 2

i j

m=h ; i = j 

= 1

@ R=@ S

= ;

In addition, the ®rst derivative vector j must be 0 otherwise p

available. The SQP step is obtained by solving two linear @

i

; i = j

systems in sequence. The ®rst, = 1

@ f

j

X

= ; :

@R 0 otherwise

^

= H S

ij j

@S i j The Jacobians of the boundary constraints are trivial. The

gradient of R is

^ S

yields a step j that minimizes a second-order approxima-

@R

= f ; R

tion to , without regard to the constraints. The second, 2i

@f

i

X

~ ^

C = J (S + S )

i j j ij and the Hessian is

j 2

@ R

; i = j

= 2

~

S

@ f @ f

yields a step j that drives linear approximations to the

i j C

i 's simultaneously to zero, and at the same time projects

; :

= 0 otherwise

^ S

the optimization step j onto the null space of the con-

~ ^

S = S + S

 Although it happens that the toy problem we chose con-

j j

straint Jacobian. The ®nal update is j .The = C strains initial and ®nal positions, nothing in the solution algorithm reaches a ®xed point when i 0 and when any

further decrease in R requires violating the constraints. approach depends on this con®guration: initial and ®nal conditions could be left free, and constraints at arbitrary

3.3 Linear system solving internal points could be added. Moreover, arbitrary con-

F (S )=

straints of the form i 0, not just position con- The choice of a method for solving these linear systems is straints, may be added provided that the constraint func- critically important, because the matrices can be large. tions and their derivatives can be evaluated.

4 4 Extension to complex models output dependencies, sparsities, etc., are recorded in a data structure accessible to the runtime system. In principle, the procedure described in the last section ex- tends to complex models, constraints, and objective func- tions. In practice, as the model grows more complex, the 4.2 User Interface problem becomes prohibitively dif®cult. The dif®culty Once de®ned, function boxes are manipulated using a lies not so much in calculating the numerical solution as graphical interface in which they appear as literal boxes in creating code to evaluate the constraint and objective on the screen, with ports representing the input and out- functions and their sparse derivatives, and in coercing the put quantities.[2] The user may instantiate boxes, con- evaluations into the form of a canonical constrained op- necting the ports to form a graph whose arcs represent timization. In particular, the required differentiations can function composition. In this way, complex systems are lead to enormous algebraic expressions that are all but built dynamically by composing pre-compiled primitives. impossible to derive and code by hand. By default, input ports to which nothing has been con- To make the method practical, we developed a lisp- nected are treated as internal constants whose values may based system that performs these dif®cult tasks automati- be inspected and modi®ed interactively, and unconnected cally. The system consists of three principle elements: a output ports are ignored. However, inputs may also be specialized math compiler that performs symbolic differ- ¯agged by the user as state variables to be solved for, and entiation and simpli®cation of tensor forms, and generates outputs may be ¯agged either as constraints or as terms to optimized code to perform the evaluations; a runtime sys- be summed into the objective function. tem that allows the generated functionsto be composed dy- namically, automatically building the vectors and sparse matrices that drive the numerical solution; and an SQP 4.3 Runtime System solver. Because the mathematical operations required to de®ne Once the graph representing the model has been con- a new primitive object or constraint are highly stylized, structed, and the state-variables, constraints, and objective it is possible to reduce the programmer's job to a simple terms declared, a pre-runtime computation is performed cookbook procedure. Once the primitives are de®ned, a to set up the constrained optimization. The user-declared

user with little or no knowledge of the underlying math- state variables, constraints, and objective terms are col-

S C R i ematics can wire them together dynamically to create an- lected and indexed to form the quantities j , ,and imation. Although a full description is beyond the scope required by the solver. The sparse derivatives are formed of this paper, this section brie¯y outlines the system and by propagationthroughthegraph using thechain rule, with the operations it performs. the individual Jacobian functions associated with function boxes combined by a hierarchy of sparse matrix multi- plications and additions. An optimal sequence of adds 4.1 Function Boxes and multiplies is pre-computed for each sparse matrix op- eration, and the sparsity patterns of the resulting global

A function box, the lowest level construct in the system,

C R

matrices are also precomputed. Evaluation of i , ,and consists of a set of input quantities, which may be scalars, their derivatives, then proceeds by recursing through the vectors, matrices, or higher-order tensors, and a collec- graph, calling the individual value and Jacobian functions, tion of output quantities each de®ned as a mathematical and performing the sparse matrix operations. The solver function of the inputs. To de®ne a function box, the pro- communicates with the model by requesting these evalua- grammer speci®es theinputs,theoutputs,and thefunctions tions and updating the state vector. that relate them. The function de®nitions are mathemati- cal expressions that may include differentiations as well as algebraic operations. Non-scalar quantities are expressed 4.4 De®ning Objects and manipulated using index notation with the summation convention. For each output, the system performs sym- Built on top of the basic system is a layer handling the bolic differentiation as called for, simpli®es the resulting speci®cs of physical object models, whose main job is to expression, extracts common sub-expressions, and gener- construct the object's equations of motion. In the case of

ates an optimized lisp function that evaluates the output the moving particle this just involved direct application of

= ma given the inputs. In addition, the system symbolically dif- f . However, deriving the equations of motion for ferentiates each output with respect to each input on which more complicated objects can be dif®cult. it depends, creates a lisp function to evaluate the deriva- We derive theequations automatically usingLagrangian tive, and analyzes its sparsity. These functions form the Dynamics [5], a classical cookbook procedure in which an Jacobians of the outputs. The generated functions, input- expression for a body's kinetic energy is subjected to a

5 series of symbolic differentiations. Lagrange's equations

of motion are given by

d @T @T

) Q = ; ( )

( 0 6

_

dt @q @ q q where T is kinetic energy, is a vector of generalized

coordinates, and Q is a generalized force. The compo- nents of the generalized coordinates are whatever variables control the positions and orientations of parts of the body (e.g. translations, , joint angles, etc.) The gener- alized force is just the sum of ordinary forces applied to body, transformed into generalized coordinates. For point forces, this transformation is accomplished by multiplying the force vector by the Jacobian of the point at which the force is applied with respect to q. Figure 1: Luxo To de®ne an object, the user is required to supply ex-

pressions for T , and for the coordinates of points on the body to which forces or constraints may be applied. Al- 5 Spacetime Luxo

though T must be derived manually, this is a manageable We are now equipped to proceed to a spacetime model of job and need only be done once when a primitive object is an animate Luxo Lamp. The model is composed of rigid de®ned. Given these expressions, automatic construction bodies of uniform mass connected by frictionless joints. of a function box representing the objects is straightfor- Each joint is equipped with a ªmuscleº modeled as an an- ward: the kinetic energy expression is subjected to the rote gular spring whose stiffness and rest angle are free to vary symbolic differentiations called for in equation 6, with an with time. The lamp is subject to the forces of its own additional derivative with respect to q used to de®ne the muscles, in addition to the external force of gravity and Jacobian of the physics constraint. The expressions for the contact forces arising from its interaction with objects material points are also differentiated with respect to q to such as ¯oors and skijumps. A picture of the model ap- create ªforce converterº functions, small Jacobian matri- pears in Figure 1. In our initial examples, Luxo's motion is ces that map applied forces into generalized coordinates.

restricted to a . This expedient simpli®es the mathe-

_ 

q q The function box takes as inputs values for q, ,and ,for matics, whilestillallowingthecreation of complex, subtle, applied forces, and for constants such as masses and di- and interesting motion. Extension of the model to three mensions. It produces outputs for the ªphysics constraintº dimensions involves no fundamental dif®culties, although de®ned by the equations of motion, and for the positions it leads to systems that are somewhat larger, somewhat and velocities of the material points de®ned by the user. slower, and more dif®cult to debug. The de®nition of the model consists of less than a page of tensor expressions, which expand into roughly 4000 lines of automatically 4.5 Discretized functions of time generated lisp code.

In developing the particle example of the last section, dis- 5.1 Kinetic Energy cretized functions representing forces and positions over time were incorporated into the equations of motion by As discussed in the last section, our principle task in de®n-

direct substitution. Given the ability to compose functions ing the model was to formulate an expression for the ki- T and their sparse Jacobians automatically, we adopted the netic energy, T . In general, is the volume integral over

1 2

_

jxj

alternative of constructing specialized function boxes to the body of the kinetic energy of each particle, 2  , x represent discretized functions. These boxes contain the where  is the mass density at point . The kinetic energy sequence of values representing the function, and output of an articulated object is the sum of the kinetic energies of the values and the time-derivatives obtained using ®nite- the parts. Each of Luxo's links is modeled as a rigid body difference formulas. The Jacobians of these output func- rotating about an axis of ®xed direction that passes through tions are trivial constant diagonal or banded matrices. The the origin in body coordinates (see Figure 2.) Because the

values and derivatives are connected to the corresponding axis is ®xed, the orientation of the i-th link may be denoted

_

 ; ! =  a

i i inputs on the object model, causing the discretization to by a singleangle i with angular velocity ,where

be effected automatically at runtime. a is a unit vector in the direction of the axis. In addition to

6

k  i

where i is the stiffness constant, is the joint angle, 

and i is the rest angle. Our model is parameterized by

link orientations rather than joint angles. The joint angle

 =   ;

i+ i

is i 1 the difference between the orientations

 ;

of the surrounding links. The generalized force on i the j

orientation of the i-th link, due to the -th muscle is

X

d

i

Q = F ;

i j

d

j

j

= k (  ); j = i +

j j

j 1

= k (  ); j = i

j j j ; = 0 otherwise

Unlike passive springs whose stiffness and rest state are

k  i constants, i and vary freely over time, allowing arbi- trary time-dependent joint forces to be exerted.

6Results

P 

Figure 2: Luxo's parameters: 0 is a , and i is 6.1 Jumping Luxo

P P the orientationof the i-th link. Points 1± 3 are computed from these parameters. Jumping motion was created using kinematic constraints to specify initial and ®nal poses, with linear interpolation

between the poses to create a trivial initial condition for

p ;

, the body origin undergoes a translation i with

the spacetime iteration. Another constraint was used to

v = dp =dt i translational velocity i . Each link has mass

put Luxo on the ¯oor during the initial and ®nal phases of

m I i i , a constant moment of inertia about the rotation axis,

the motion. Subject to these and the physics constraint, c

and a center of mass i expressed as a displacement from

_

F  the body origin. In these terms, the kinetic energy of the we minimized the power due to the muscles,  . In one variation, we adjusted the mass of Luxo's base, leaving the i-th link is situationotherwiseunchanged. In another, we additionally

1 2 1 2

= m jv j + m !  v  c + j! j I : ( )

T constrained the force of contact with the ¯oor on landing,

i i i i i i i i i 7 2 2 to produce a relatively soft landing. In a ®nal variation, To connect the links, each link inherits as its translation we added a hurdle, together with a constraint that the jump the positionof the previous link's endpoint,with the base's clear the hurdle.

translation, P, serving as a translation parameter for the The pose constraints consisted of values for the three

v i whole model. The translational velocity i of the -th link joint angles, and were applied to the ®rst two and last two

is thus frames of motion. Because we measure velocity using a P

d ®nite difference, this incorporates the additional constraint

v = ; i =

i 0 that Luxo be at rest at the beginning and end of motion.

dt

v + r  ! ;

= Initial values for the orientations were obtained by linear

i i i 1 1 1 otherwise

interpolation between the two poses.

r (i ) where i 1 is a vector from the 1 -th link's center of The ¯oor enters both as a kinematic constraint and as a rotation to its point of attachment with the i-th link. The force. In general, collision constraints appear as inequali-

total kinetic energy T is obtained by recursively substitut- ties, but to simplify matters, we chose to specify explicitly T ing this expression into equation 7 to obtain the i 's, and the time intervals during which Luxo was on the ¯oor,

summing over i. imposing during those times the equality constraints



 = ; P P =

5.2 Muscles 0 f 0 0 2

Luxo's muscles are three angular springs, one situated at P where  is the orientation of the base, is the position

each joint. The spring force on the joint connecting the 0 P

of the center of the base, and f is a constant point on

(i + ) i-th and 1 -th links is de®ned by

the ¯oor. In other words, the position and orientation

F = k (  );

i i i i of the base are nailed. The limitation of this formulation,

7 compared toan inequality,is that thetimes at which contact ¯ight, then rises smoothly to its pre-speci®ed ®nal pose. occurs must be pre-speci®ed, rather than allowing things In the ®rst variation on the basic jump, we add an addi- to bounce freely. The ¯oor constraint was enabled for the tional constraint ®xing the contact force on landing. The ®rst and last ®ve frames, allowing time for anticipation value we choose provides control over a hard-to-soft land-

and follow-through. Of course, two different values were ing dimensionÐa large landing force leads to an exagger- P used for f at the start and ®nish, de®ning the start end ated stomp, as if trying to squash a bug, while a small points of the jump. value leads to a soft landing, as if trying to avoid break- The ¯oor constraint represents a mechanical interaction ing something fragile. Figure 4 shows a relatively soft involving the transmission of force between the base and landing, generated under the same conditions as the basic the ¯oor. This contact force must be taken into account to jump except for the contact force constraint. Comparing satisfy the physics constraint. The simple contact model the motion to the basic jump, we see that Luxo softened used for the jump has the base colliding with the ¯oor the blow of impact by squashing while moving toward im- inelastically with in®nite friction, which means that the pact, reducing the velocity, and hence the kinetic energy base comes to rest, losing its kinetic energy, at the mo- of the base. In contrast, the basic jump has a small stretch

ment of contact. The contact force is therefore whatever before impact, producing an energy-absorbing stomp.  arbitrary force on the baseÐspeci®cally, on P and 0Ðis The next variation has the same conditions as the basic required to satisfy physics in light of the ¯oor constraint. jump, but the mass of the base has been doubled. The No special provision need be made to solve for the con- ®nal motion is shown in Figure 5. As expected, both the tact forces beyond introducing additional state variables to anticipation and follow-through are exaggerated in com- represent them. Their values are then determined during pensation for the greater mass. the constraint-solving process. This method of solving for A ®nal variation, shown in Figure 6, has the conditions constraint forces applies to other mechanical constraints, of the soft-landing jump, but with a hurdle interposed be- such as joint attachments, and is closely related to the tween start and ®nish, and an additional constraint that method of Lagrange multipliers. Luxo clear the hurdle. As one would expect, the extra The choice of optimization criteria is an area we have height required is gained by squashing vigorously on ap- just begun to explore. In theexamples shown, we soughtto proaching the wall. optimize a measure of the motion's mechanical ef®ciency The jumping examples each took under 10 minutes to by minimizing the power consumed by the muscles at each compute on a Symbolics 3640. While this is hardly in- time step, which for each joint is the product of the muscle teractive speed, it constitutes a tiny fraction of the cost of force and the joint's angular velocity. Our preliminary high-quality rendering. observation is that this criterion produces relatively ¯uid and natural motion, compared to kinematic smoothness 6.2 Ski Jumping criteria in terms of velocity and acceleration, which tend to come out looking somewhat arthritic. Figure 7 shows Luxo descending a ski jump. As in the Figure 3 shows a series of iterations leading from an ini- previous case, Luxo is constrained to be on the ski jump tial motion in which Luxo translates, ¯oating well above and the landing at particular time samples. The biggest the ¯oor, to a ®nished jump in which all the constraints difference between the ski-jump and the in®nite-friction are met and the objective function is minimized. Note ¯oor of the previous example is that Luxo is free to slide, that the elements of realistic motion already appear after with the exact positions on the ski jump and the landing the ®rst iteration. The ®nal motion shows marked antici- left unspeci®ed except at the top and bottom of the ski pation, squash-and-stretch, and follow-through. From its jump. In addition, there is a constraint that the orientation pre-de®ned initial pose, Luxo assumes a crouch providing of the base must be tangent to the surface it is resting on. a pose from which to build momentum. The crouch is fol- Both the ski jump and landing exert forces on Luxo. lowed by a momentum-building forward-and-upward ex- There is a normal force which keeps him from falling tension to a stretched launching position. While in ¯ight, through and a frictional force which is tangent to the sur- the center of mass moves ballisticallyalong a parabolic arc face and proportional to the tangential velocity. The coef- determined by the launch velocity and by the force of grav- ®cients of friction were state variables in the optimization. ity. Toward the end of the ¯ight, Luxo once again assumes At one time instant while Luxo is in the air, the height a crouched position in anticipation of landing, extending of his base is constrained. In addition, there is a term slightly while moving toward impact. This ªstompº ma- in the objective function which gives him a preference neuver has the effect of transferring kinetic energy into the for a particular pose while in the air. This is a ªstyleº base, where it vanishes in the inelastic collision with the optimization without which Luxo is content to go through ¯oor. Following impact, luxo extends forward while com- the air in a bent position. pressing slightly, dissipating the remaining momentum of Luxo is also given pose constraints at the beginning and

8 end of the motion. Unlike the previous jumps, however, another, pursued by a bear. Plainly the character's goalsÐ his initial velocity is unconstrained. and attendant criteria of optimalityÐare very different in The initial condition for the optimization was a uniform each case. We would hope to see these differing goals translation in the air above both the ski jump and the re¯ected in the motion. The possibility of controlling mo- landing. In the ®rst iteration, Luxo puts his feet on the tion directly in terms of its goals, not just where it goes ski jump and landing. By iteration 4, there is signi®cant but how, is one we intend to explore. anticipation and follow through. Figure 7 is the result after 16 iterations. Both the ski jump and landing are built from two B- References spline segments. The entire jump was computed with 28 time samples in the optimization. There were 223 con- [1] Ronen Barzel and Alan H. Barr. A modeling system straints and 394 state variables. The Jacobian contained based on dynamic constaints. , 3587 non-zero entries, about 4% of the total number of 22:179±188, 1988. entries. The entire motion was computed in 45 minutes on [2] Kurt Fleischer and Andrew Witkin. A modeling a Symbolics 3600. testbed. In Proc. Graphics Interface, pages 127±137, 1988. 7 Discussion [3] Phillip Gill, Walter Murray, and Margret Wright. Practical Optimization. Academic Press, New York, Our results show that spacetime methods are capable NY, 1981. of producing realistic, complex and coordinated motion given only minimal kinematic constraints. Such ba- [4] Michael Girard and Anthony A. Maciejewski. Com- sic attributes as anticipation, squash-and-stretch, follow- putational Modeling for the Computer Animation of through, and timing emerge on their own from the require- Legged Figures. Proc. SIGGRAPH, pages 263±270, ment that the kinematic constraints be met in a physically 1985. valid way subject to simple optimization criteria. [5] Herbert Goldstein. Classical Mechanics. Addision The principleadvantage of spacetime methods over sim- Wesley, Reading, MA, 1950. ple keyframing is that they do much of the work that the animator would otherwise be required to do, and that only [6] David Haumann. Topics in Physically Based Model- a skilled animator can do. Motions that would require ing, Course Notes, volume 16, chapter Modeling the highly detailed keyframe information may be sketched Physical Behavior of Flexible Objects. SIGGRAPH, out at the level of ªstart hereº and ªstop there.º This is a 1987. profoundly different and more economical means of con- trol than conventional keyframing affords, an advantage [7] Paul Issacs and Michael Cohen. Controlling dy- that easily outweighs the greater mathematical complexity namic simulation with kinematic constraints, be- and computational cost of the method. havior functions and inverse dynamics. Computer Graphics, 21(4):215±224, July 1987. Proc. SIG- Beyond sparser keyframing, spacetime methods offer GRAPH '87. really new forms of motion control. For example, we saw in the previous section that constraints on forces, such as [8] Charless Klein and Ching-Hsiang Huang. Review of the force of a collision, can be used in a direct and simple Pseudoinverse Control for Use With Kinematically way to say ªhit hardº or ªhit softly,º producing subtle but Redundant Manipulators. IEEE Trans. SMC, 13(3), very effective changes in the motion. 1983. Of the new opportunities for motion control, perhaps the most exciting is the selection of optimization criteria [9] Johen Lasseter. Principles of traditionial animation to affect the motion globally, an area we have only begun applied to3D computer animation. ComputerGraph- to explore. With a little thought, it is clear that a magic ics, 21(4):35±44, 1987. ªrightº criterion, whether based on smoothness, ef®ciency or some other principle, is unlikely to emerge and would [10] Pixar. Luxo, Jr., 1986. ®lm. in any case be undesirable. This is because the ªoptimalº [11] W.H. Press, B.P.Flannery, S. A. Teukolsky, and W. T. way to perform a motion, as with any optimization, de- Vetterling. Numerical Recipes in C. Cambridge Uni- pends on what you're trying to do. Consider for example versity Press, Cambridge, England, 1988. several versions of a character crossing a room: in one case, walking on hot coals; in another, walking on eggs; [12] Robert S. Stengel. Stochastic Optimal Control. John in another, carrying a full bowl of hot soup; and in still Wiley and Sons, New York, New York, 1986.

9 [13] , John Platt, Alan Barr, and Kurt Fleischer. Elastically deformable models. Computer Graphics, 21(4), July 1987. Proc. SIGGRAPH '87. [14] Jane Wilhelms and Brian Barsky. Using dynamic analysis toanimate articulated bodies such as humans and robots. Graphics Interface, 1985. [15] Andrew Witkin, Kurt Fleischer, and Alan Barr. En- ergy constraints on parameterized models. Computer Graphics, 21(4):225±232, July 1987.

Figure 3: From top to bottom, a series of iterations lead- ing from an initial motion in which Luxo translates, ¯oat- ing above the ¯oor, to a ®nished jump in which all the constraints are met and the optimization function is min- 10 imized. The ®nal motion shows marked anticipation, squash-and-stretch, and follow-through. Figure 4: A variation on the basic jump in which the con- tact force on landing is constrained to be small. The force of impact is reduced by squashing just before landing, re- ducing the velocity and hence the kinetic energy of the base. In contrast, the jump in Figure 3 exhibits a slight stretch before impact, producing an energy-absorbing stomp.

Figure 7: Ski Jump

Figure 5: The mass of Luxo's base has been doubled. In other respects, the conditions are the same as those producing the basic jump.

Figure 8: Spacetime constraints: a cartoonist's view. (c) 1988 by Laura Green, used by permission.

Figure 6: Hurdle Jump

11