<<

~ ComputerGraphics, Volume 22, Number 4, August 1988

l, Spacetime Constraints

Andrew Witkin

Schlumberger Palo Alto Research 3340 Hillview Avenue, Palo Alto, CA 9~30~

Abstract Siggraph '87 [12]. Although £uzo, 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 defining the motion acter . The animator specifies what the char- remains almost entirely with the animator. acter has to do, for instance, "jump from here to there, Some aspects of animation--personality and appeal, clearing a hurdle in between;" how the motion should be for example---will surely be left to the animator's artistry performed, for instance "don't waste energy," or "come and skill for a long time to come. However, many of the down hard enough to splatter whatever you land on;" the principles of animation are concerned with making the character's physical structure--the geometry, mass, con- character's motion look real at a basic mechanical level nectivity, etc. of the parts; and the physical resources, that ought to admit to formal physical treatment. Con- available to the character to accomplish the motion, for sider for example a jump exhibiting anticipation, squash- instance the character's muscles, a floor to push off from, and-stretch, and follow-through. Any creature--human or etc. The requirements contained in this description, to- lamp--can only accelerate its own center of mass by push- gether with Newton's laws, comprise a problem of con- ing on something else. In jumping, the opportunity to con- strained optimization. The solution to this problem is a trol acceleration only exists during contact with the floor, phyJically valid motion satisfying the "what" constraints because while airborne there is nothing to push on. Antici- and optimizing the "how" criteria. We present as exam- pation prior to takeoff is the phase in which the needed mo- pies a Luxo lamp performing a variety of coordinated mo- mentum is acquired by squashing then stretching to push tions. These realistic motions conform to such principles of off against the floor. Follow-through is the phase in which traditional animation as anticipation, squash-and-stretch, the momentum on landing is absorbed. follow-through, and timing. Such physical arguments make nice poJt hoe 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 directly I. Introduction from first principles, and how much is really a matter of Computer animation has made enormous strides in the style and convention? past several years. In particular, 's Luzo, Jr. [13] This paper presents a physically-based approach to marked a turning point as perhaps the first computer- character animation in which coordinated, active motion generated work to compete seriously with works of tra- is created automatically by specifying: ditional animation on every front. Key among the reasons • What the character has to do, for instance "jump from for Luzo, .)'r. 's success is that it was made by a talented here to there." animator who adapted the principles of traditional anima- • How the motion should be performed, for instance tion to the computer medium. Luzo, Jr., in large measure, "don't waste energy," or "come down hard enough is a work of traditional animation that happens to use a to splatter whatever you land on." computer to render and to interpolate between keyframes. John Lasseter speUed this out clearly in his presentation to • What the character's physical structure is--what the pieces are shaped llke, what they weigh, how they're Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct connected, etc. commercial advantage, the ACM copyright notice and the title of the • What physical resources are available to the charac- publication and its date appear, and notice is given that copying is by ter to accomplish the desired motion, for instance the permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. character's muscles (or whatever an animate lamp has in place of muscles,) a floor to push off from, etc.

@1988 ACM-0-89791-275-6/88/008/0159 $00.75 "Luxo" is a trademark of Jac Jacobsen Industries AS.

159 SIGGRAPH '88, Atlanta, August 1-5, 1988

Our initial experiments with this approach have aimed or completely constrained, are called two-point boundar!l at making a Luxo lamp execute a convincing jump just by problems, requiring more elaborate solution methods than telling it where to start mad where to end. The results forward simulation.[6] we present in this paper show that such properties as an- Character animation poses a still more difficult prob- ticipation, follow-through, squash-and-stretch, and timing lem. Animals move by using their muscles to exert forces indeed emerge from a bare description of the motion's pur- that vary as a function of time. Calculating the motion by pose and the physical context in which it occurs. Moreover, simulation is straightforward once these tlme-dependent simple changes to the goals of the motion or to the phys- force functions are known, but the difficult problem is to ical model give rise to interesting variations on the basic calculate force functions that achieve the goals of the mo- motion. For example, doubling (or quadrupling) the mass tion. Specifying these functions by hvaad would be hope- of Luxo's base creates amusingly exaggerated motion in less, equivalent to making a robot move gracefuLly by man- which the base 1oo~ heavy. ually varying its motor torques. OvLr method entails the numerical solution of laxge In an effort to reconcile the advaaatages of simula- constrained optimization problems, for which a variety of tion with the need for control, several researchers [2, 10] standard algorithms exist. These algorithms, while rela- have proposed methods for blending positional constraints tively expensive, spend most of their time solving sparse with dynamic simulations. The idea behind these meth- linear systems, and are therefore amenable to accelera- ods is to treat kinematic constraints as the consequences tion by array processors and other commonly available of unknown "constraint forces," solve for the forces, then hardware. The greatest difficulty arises not in comput- add them into the simulation, exactly canceling that com- ing the numerical solution, but in setting up the intricate ponent of the applied forces that fights against the con- sparse matrix equations that drive the solution process. To straints. address this problem we implemented an object-oriented Constraint force methods permit parts, such as a symbolic algebra system that automates this difficult task character's hands or feet, to be moved along predefined almost entirely. We therefore believe the method described keyframed trajectories, but provide no help in defining here can become a practical animation tool requiring no the trajectories, which is the central problem in creat- more mathematical sophistication of the end user than do ing character animation. While allowing a character to current keyframlng systems. be dragged around manually like a marionette, constraint The remainder of the paper is organized as follows: forces sidestep the central issue of deciding how the char- the following section discusses the previous use of physical acter should move. methods in animation. The spacetime method is then in- These shortcomings led us to adopt a new formula- troduced using a moving particle as a toy example. Next, tion of the constraint problem, whose central characteris- our extension of the method to complex problems is dis- tic is that we solve for the character's motion and time- cussed. Finally, the Luxo model and the results obtained varying muscle forces over the entire time interval of in- with it are described. terest, rather than progressing sequentially through time. Because we extend the model through time as well as space, II. Background and Motivation we call the formulation spacetim¢ constraints. The spacetime formulation permits the imposition of Recently, there has been considerable interest in incorpo- constraints throughout the time course of the motion, rating physics into animation using simulation methods. with the effects of constraints propagating freely back- [10, 17, 18, 2, 16, 7, 9] The appeal of physical simulation ward as well as forward in time. Constraints on initial, as an animation technique lies in its promise to produce re- final, or intermediate positions and velocities directly en- alistic motion automatically by applying the same physical code the goal~ of the motion, while constraints limiting laws that govern real objects' behavior. muscle forces or preventing interpenetration define prop- Unfortunately, the realism of simulation comes at the erties of the physical situation. Additionally, Newtouian expense of control. Simulation methods solve initial value physics provides a constraint relating the force and po- problems: the course of a simulation is completely deter- sition functions that must hold at every instant in time. mined by the objects' initial positions and velocities, and Subject to these constraints we optimize functions that by the forces applied to the objects along the way. An an- specify how the motion should be performed, in terms of imator, however, is usually concerned as much with where efficiency, smoothness, etc. Solving this constrained opti- the objects end up and how they get there as where they mization problem yields optimal, physically valid motion begin. Problems cast in this form are not initial value that achieves the goals specified by the animator. problems. For instance, while simulating a bouncing ball is easy enough, making the ball bounce to a particular place III. A spacetlme particle requires choosing just the right starting values for posi- tion, velocity, and spin• Making these choices manually is As a gentle but concrete introduction to the spacetime a painful matter of trial and error. Problems such as this method, this section describes a minimal example involv- one, in which both initial and final conditions are partially ing a moving particle, influenced by gravity, and equipped

160 ~ , Volume 22, Number 4, August1988 i

with a "jet engine" as a means of locomotion. With no xi = Xi+l -- 2xi+xi-1 restrictions on the forces exerted by its engine, the parti- h~ (3) cle can move any way it likes. The problem we formulate here is that of making the particle fly from a given start- Substituting these relations into equation 1 gives n ing point to a given destination in a fixed period of time, "physics constraints" relating the zi's to the fi's, with minimal fuel consumption. This toy problem is too simple to produce any really interesting motion, but it ex- Xi+l--2xi+xi-l--fi--Tng=O , l

A. Problem formulation Ca=Xl--a=O Let the particle's position as a function of time be x(t), and the time-varying jet force be f(t). Suppose for sim- and plicity that the mass of the fuel is negligible compared to Cb=Xn--b=0. that of the particle, so the total mass may be treated as a constant, ra, with a constant gravitational force rag. Then Assuming that f(t) is constant between samples, the ob- the parrticle's equation of motion is jective function R becomes a sum

m~- f- mg = 0, (1) R = h~ If~l' (5) where i is the second time derivative of position. Given i the function f(t), and initial values for x and ± at some which is to be minimized subject to the constraints. The time to, the motion x(t) from to could be obtained by discretized objective and constraint functions are now ex- integrating equation 1 to solve the initial value problem. pressed in terms of the xi's and the fi's, which are the Instead we wish to make the particle fly from a known independent variables to he solved for. point a to a known point b in a fixed period of time. Sup- pose for simplicity that the rate of fuel consumption is Ill z. B. Numerical Solution In that case, we have constraints x(t0) = a and x(tl) = b From the standpoint of the numerical solution process it is subject to which useful to suppress the structure of tbe particular problem, reducing it to a canonical form consisting of a collection of R = If(t)l 2 dt scalar independent variables Sj, 1 ~ j ~ n, an objective function to be minimized, and a collection of scalar must be minimized. The problem then is to find a force R(Sj) function f(t), defined on the interval (t0, tl), such that the constraint functions Ci(Sj), 1 < i < m, which must be driven to zero. In the current problem, the the position function x(t) obtained by solving equation I satis- Sj's are z, y, aud z components of the xi's and the fi's, while the fies the boundary constraints, and such that the objective Ci's are the components of the pi's, ca, and cb. TypicMly, function R is a constrained minimum. setting up the Hnearlzed indices is the responsibility of a There exist a variety of standard approaches to solv- program that keeps track of the independent variables and ing problems of this form. Prevalent in the optimal con- the constraint functions. trol literature are iterative methods that solve the initial In these terms, the standard constrained optimiza- value problem within each iteration, using the equations tion problem is "Find Sj that minimizes subject of motion to obtain the position function from the force R(Sj) to = 0. For the sake of modtdarity, the humeri- function (see [15] for a good survey.) We choose instead to Ci(Sj) cat method that solves the problem is best regarded as an represent the functions x(t) and f(t) independently. The object that requests answers to certain standard questions equation of motion then enters as a constraint that re- lates the two functions, to be satisfied along with the other about the system, and iteratively provides updated vMues constraints during the so]ation process. Each function is for the solution vector Sj. Any method must be permitted discretized, that is, represented as a sequence of values, to request the values of R and C~ at a given Sj. In addi- with time derivatives approximated by finite differences. tion, most effective methods require access to derivativeJ This approach leads to a classical problem in constrained of R and Ci with respect to Sj, in order to move toward a optimization, for which a variety of standard solution al- solution. gorithms are available. The solution method we use is a variant of Sequential Let the discretized functions x(t) and f(t) be repre- Quadratic Programming (SQP), described in detail in [6]. Essentially, the method computes a second-order Newton- sented by sequences of values xl and fi, 0 < i < n, with Raphson step in R, and a first-order Newton-Raphson step h the time interval between samples. To approximate the time derivatives of x(t) we use the finite difference formulas in the Ci's, and combines the two steps by projecting the first onto the null space of the second (that is, onto the Xi = Xi -- hXi--1 (2) hyperplvme for which all the Ci's are constant to first or- der.) Because it is first-order in the constraint functions

161 SIGGRAPH '88, Atlanta, August 1-5, 1988

and second-order in the objective function, the method re- as well as the objective and constraint functions them- quires that we be able to compute two derivative matrices: selves. Apart from the bookkeeping required for indexing, the dacobian of the constraint functions, given by these evaluations are straightforward. The Jacobian of the physics constraint is given by

Jq = ~, Opi _ 2ra/h2 ' i-- j Oxi and the Hessian of the objective function, = -m/h 2, i=jrkl O2 R = O, otherwise Opt 0fj = 1, i =j In addition, the first derivative vector OR/OSj must be = 0, otherwise. available. The SQP step is obtained by solving two linear systems in sequence. The first, The Jacobians of the boundary constraints are trivial. The gradient of R is OR OR = 2f,, J and the Hessian is yields a step S$ that minimizes a second-order approxima- = 2, i=j tion to .R, without regard to the constraints. The second, 0fi0fi = O, otherwise.

J Although it happens that the toy problem we chose constrains initial and final positions, nothing in the solu- yields a step Sj that drives linear approximations to the tion approach depends on this configuration: initial and Ci's simultaneously to zero, and at the same time projects final conditions could be left free, and constraints at arbi- the optimization step Sj onto the null space of the con- trary internal points could be added. Moreover, arbitrary straint Jacobian. The final update is AS s = S# + ~#. The constraints of the form F(S~) = 0, not just position con- algorithm reaches a fixed point when Ci = 0 and when any straints, may be added provided that the constraint func- further decrease in R requires violating the constraints. tions and their derivatives can be evaluated. C. Linear system solving IV. Extension to complex models The choice of a method for solving these linear systems is In principle, the procedure described in the last section ex- critically important, because the matrices can be large. tends to complex models, constraints, and objective func- Although inverting a general n x n matrix is O(ns), tions. In practice, as the model grows more complex, the the matrices arising in spacetime problems are nearly al- problem becomes prohibitively difficult. The difficultylies ways extremely sparse. Exploiting the sparsity is essen- not so much in calculating the numerical solution as in cre- tial to make the problem tractable. Moreover, over- and ating code to evaluate the constraint and objective func- under-constrained systems, whose matrices are non-square tions and their sparse derivatives, and in coercing the eval- and/or rank-deficient, can easily arise, in which case the uatlons into the form of a canonical constrained optimiza- inverse is undefined and the system cannot be solved. The tion. In particular, the required differentiations can lead to latter problem is well treated by the pseudo-inverse [11, 7], enormous algebraic expressions that are all but impossible which provides least-squares solutions to overconstrained to derive and code by hand. problems, and minimal solutions to underconstrained ones. To make the method practical, we developed a lisp- To compute the pseudo-inverse while exploiting random based system that performs these difficult tasks automat- sparslty, we adapted a sparse conjugate gradient (CG) ically. The system consists of three principle elements: a algorithm described in [14}, which is O(n z) for typical specialized math compiler that performs symbolic differ- problems. The CG algorithm solves the matrix equation entiation and simplification of tensor forms, and generates a = Mb by iteratively minimizing [a- Mb[ z, giving a optimized code to perform the evaluations; a runtime sys- least-squares solution to overconstrained problems. Pro- tem that allows the generated functions to be composed vided that a zero starting-point is given for b, the solution dynamically, automatically building the vectors and sparse vector is restricted to the null-space complement of M. matrices that drive the numerical solution; and an SQP solver. D. Matrix evaluation. Because the mathematical operations required to de- Applying the SQP algorithm to the moving particle exam- fine a new primitive object or constraint are highly styl- ple requires evaluation of the sparse derivative matrices, ized, it is possible to reduce the programmer's job to a

162 ~ ComputerGraphics, Volume 22, Number 4, August 1988

simple cookbook procedure. Once the primitives are de- matrix multiplications and additions. An optimal sequence fined, a user with little or no knowledge of the underlying of adds and multiplies is pre-computed for each sparse ma- mathematics can wire them together dynamically to cre- trix operation, and the sparslty patterns of the resulting ate animation. Although a full description is beyond the global matrices are also precomputed. Evaluation of Ci, R, scope of this paper, this section briefly outlines the system and their derivatives, then proceeds by recursing through and the operations it performs. the graph, calling the individual value and 3acobian func- tions, and performing the sparse matrix operations. The A. Function Boxes solver communicates with the model by requesting these A function boz, the lowest level construct in the system, evaluations and updating the state vector. consists of a set of input quantities, which may be scalars, vectors, matrices, or higher-order re,sots, and a collection of output quantities each defined as a mathematical func- D. Defining Objects tion of the inputs. To define a function box, the program- ~ullt on top of the basic system is a layer handling the mer specifies the inputs, the outputs, and the functions specifics of physical object models, whose main job is to that relate them. The function definitions are mathemati- cal expressions that may include differentiations as well as construct the object's equations of motion. In the case of algebraic operations. Non-scalar quantities are expressed the moving particle this just involved direct application of f = ma. However, deriving the equations of motion for and manipulated using index notation with the summation more complicated objects can be difficult. convention. For each output, the system performs sym- bolic differentiation as called for, simplifies the resulting We derive the equations automatically using La- expression, extracts common sub-expressions, and gener- granglan Dynamics [8], a classical cookbook procedure in ates an optimized lisp function that evaluates the output which an expression for a body's kinetic energy is sub- given the inputs. In addition, the system symbolically dif- jected to a series of symbolic differentiations. Lagrange's ferentiates each output with respect to each input on which equations of motion are given by it depends, creates a lisp function to evaluate the deriva- tive, and analyzes its sparsity. These functions form the d 0T 0T Jacobians of the outputs. The generated functions, input- ~(~q) -- qo"-- - q = 0, (6) output dependencies, spaxsities, etc., are recozded in a data structure accessible to the runtime system. where T is kinetic energy, q is a vector of generalized co- ordinates, and Q is a generalized force. The components B. User Interface of the generalized coordinates axe whatever variables con- Once defined, function boxes are manipulated using a trol the positions and orientations of parts of the body graphical interface in which they appear as literal boxes (e.g. translations, rotations, joint angles, etc.) The gen- on the screen, with ports representing the input and out- eralized force is just the sum of ordinary forces applied to put quantities.[5] The user may instaatiate boxes, con- body, transformed into generalized coordinates. For point necting the ports to form a graph whose ares represent forces, this transformation is accomplished by multiplying function composition. In this way, complex systems are the force vector by the Jacobin" of the point at which the built dynamically by composing pre-compiled primitives. force is applied with respect to q. By default, input ports to which nothing has been con- To define an object, the user is required to supply ex- nected axe treated as internal constants whose values may pressions for T, and for the coordinates of points on the be inspected and modified interactively, and unconnected body to which forces or constraints may be applied. Al- output ports are ignored. However, inputs may also be though T must be derived manually, this is a manageable flagged by the user as state variables to be solved for, and job and need only be done once when a primitive object is outputs may be flagged either as constraints or as terms defined. Given these expressions, automatic construction to be summed into the objective function. of a function box representing the objects is straightfor- ward: the kinetic energy expression is subjected to the C. Runtime System rote symbolic differentiations called for in equation 6, with Once the graph representing the model has been con- an additional derivative with respect to q used to define structed, and the state-variables, constraints, and objec- the 3acobian of the physics constraint. The expressions for tive terms declared, a pre-runtime computation is per- material points are also differentiated with respect to q to formed to set up the constrained optimization. The user- create "force converter" functions, small Jacobin, matri- declared state vaxiables, constraints, and objective terms ces that map applied forces into generalized coordinates. axe collected and indexed to form the quantities Sj, C~, The function box takes as inputs values for q, el, and/t, and R required by the solver. The sparse derivatives for applied forces, and for constants such as masses and di- are formed by propagation through the graph using the mensions. It produces outputs for the "physics constraint" chain rule, with the individual Jacobian functions associ- defined by the equations of motion, and for the positions ated with function boxes combined by a hierarchy of sparse and velocities of the material points defined by the user.

163 ¢ SIGGRAPH '88, Atlanta, August 1-5, 1988

P~ 02

Pl o I

0 0

Figure 1: Luxo

E. Discretized functions of time In developing the particle example of the last section, dis- Figure 2: Luxo's paxameters: P0 is a translation, and 01 cretized functions representing forces and positions over is the orientation of the i-th link. Points Pl-P3 axe com- time were incorporated into the equations of motion by di-. puted from these parameters. rect substitution. Given the ability to compose functions and their sparse Jacohians automatically, we adopted the alternative of constructing specialized function boxes to energy, T. In general, T is the volume integral over the represent discretized functions. These boxes contain the body of the kinetic energy of each paxticle, ~p1 I±i z, where sequence of values representing the function, and output p is the mass density at point =. The kinetic energy of an the values and the time-derivatives obtained using finite- articulated object is the sum of the kinetic energies of the difference formulas. The Jacobians of these output func- parts. Each of Luxo's links is modeled as a rigid body ro- tions are trivial constant diagonal or banded matrices. The tating about an axis of fixed direction that passes through values and derivatives are connected to the corresponding the origin in body coordinates (see Figure 2.) Because the inputs on the object model, causing the discretization to axis is fixed, the orientation of the i-th link may be denoted be effected automatically at runtime. by a single angle 01, with angular velocity wi = 0is, where a is a unit vector in the direction of the axis. In addition to V. Spacetime Luxo rotation, the body origin undergoes a translation Pl, with translational velocity vl = dpi/dt. Each link has mass ml, We axe now equipped to proceed to a spacetime model of a constant moment of inertia _ri about the rotation axis, an animate Luxo Lamp. The model is composed of r/gid and a center of mass ci expressed as a displacement from bodies of uniform mass connected by frictionless joints. the body origin. In these terms, the kinetic energy of the Each joint is equipped with a "muscle" modded as an an- i-th link is gular spring whose stiffness and rest angle are free to vary with time. The lamp is subject to the forces of its own muscles, in addition to the external force of gravity and Ti = ~m,1 Ivil 2 + mlwi • Vi × Ci "1- 1 [wilzZi. (r) the contact forces arising from its interaction with objects such as floors and skijumps. A picture of the model ap- To connect the links, each link inherits as its translation pears in Figure 1. In our initial examples, Luxo's motion is the position of the previous Unk's endpoint, with the base's restricted to a plane. This expedient simplifies the mathe- translation, P, serving as a translation paxameter for the matics, while still allowing the creation of complex, subtle, whole modal. The translational velocity v~ of the i-th link and interesting motion. Extension of the model to three is thus dimensions involves no fundamental difficulties, although it leads to systems that axe somewhat laxger, somewhat dP slower, and more difficult to debug. The definition of the Vi -- i=0 dt ' model consists of less than a page of tensor expressions, = Vi_ 1 + ri_ 1 X Wi--l, otherwise which expand into roughly 4000 lines of automatically gen- erated lisp code. where ri-1 is a vector from the (i - 1)-th link's center of A. Kinetic Energy rotation to its point of attachment with the i-th link. The total kinetic energy T is obtained by recursively substitut- As discussed in the last section, our principle task in defin- ing this expression into equation 7 to obtain the Ti's, and ing the model was to formulate an expression for the kinetic summing over i.

164 ~ ComputerGraphics, Volume 22, Number 4, August 1988

B. Muscles floor. In other words, the position and orientation of the base are nailed. The limitation of this formulation, com- Luxo's muscles are three angular springs, one situated at pared to an inequality, is that the times at which contact each joint. The spring force on the joint connecting the occurs must be pre-specified, rather than allowing things i-th and (i + 1)-th links is defined by to bounce freely. The floor constraint was enabled for the F~ = k~(¢~ - p~), first and last five frames , allowing time for anticipation and follow-through. Of course, two different values were used where ki is the stiffness constant, ¢i is the joint angle, and for P! at the start and finish, defining the start end points pi is the rest angle. Our model is parameterlzed by ]ink of the jump. orientations rather than joint angles. The joint angle is The floor constraint represents a mechanical interac- ~bi ---- 0i+t - 01, the difference between the orientations of tion involving the transmission of force between the base the surrounding links. The generalized force on 01, the and the floor. This contact force must be taken into ac- orientation of the i-th link, due to the j-th muscle is count to satisfy the physics constraint. The simple contact model used for the jump has the base colliding with the floor inelastically with infinite friction, which means that dOj J the base comes to rest, losing its kinetic energy, at the mo- = k~(¢~-p~), j=i+l ment of contact. The contact force is therefore whatever arbitrary force on the base specifically, on P and 0e--is = -k~(~ - p~), j = i required to satisfy physics in light of the :floor constraint. = O, otherwise No special provision need be made to solve for the contact forces beyond introducing additional state variables to rep- Unlike passive springs whose stiffness and rest state are resent them. Their values are then determined during the constants, /el and Pl vary freely over time, allowing arbi- constraint-solving process. This method of solving for con- trary time-dependent joint forces to be exerted. straint forces applies to other mechanical constraints, such as joint attachments, and is closely related to the method VI. Results of Lagrange multipliers. A. Jumping Luxo The choice of optimization criteria is an area we have just begun to explore. In the examples shown, we sought Jumping motion was created using kinematic constraints to optimize a measure of the morton's mechanical efficiency to specify initial and final poses, with linear interpolation by minimizing the power consumed by the muscles at each between the poses to create a trivial initial condition for time step, which for each joint is the product of the muscle the spacetime iteration. Another constraint was used to force and the joint's angular velocity. Our preliminary put Luxo on the floor during the initial and final phases of observation is that this criterion produces relatively fluid the motion. Subject to these and the physics constraint, and natural motion, compared to kinematic smoothness we minimized the power due to the muscles, Fs0. In one criteria in terms of velocity and acceleration, which tend variation, we adjusted the mass of Luxo's base, leaving the to come out looking somewhat arthritic. situation otherwise unchanged. In another, we additionally Figure 3 shows a series of iterations leading from an constrained the force of contact with the floor on landing, initial motion in which Luxo translates, floating well above to produce a relatively soft landing. In a final variation, we the floor, to a finished jump in which all the constraints added a hurdle, together with a constraint that the jump are met and the objective function is minimized. Note clear the hurdle. that the elements of realistic motion already appear after The pose constraints consisted of values for the three the first iteration. The final motion shows marked an- joint angles, and were applied to the first two and last two ticipation, squash-and-stretch, and follow-through. From fraxnes of motion. Because we measure velocity using a its pre-defined initial pose, Luxo assumes a crouch provid- finite difference, this incorporates the additional constraint ing a pose from which to build momentum. The crouch is that Luxo be at rest at the beginning and end of motion. Initial values for the orientations were obtained by linear followed by a momentum-building forward-and-upward ex- tension to a stretched launching position. While in flight, interpolation between the two poses. The floor enters both as a kinematic constraint and as the center of mass moves ballistically along a parabolic arc a force. In general, collision constraints appear as inequal- determined by the launch velocity and by the force of grav- ities, but to simplify matters, we chose to specify explicitly ity. Toward the end of the flight, Lu.xo once again assumes the time intervals during which Luxo was on the floor, im- a crouched position in anticipation of landing, extending posing during those times the equality constraints sIightly while moving toward impact. This "stomp" ma- neuver has the effect of transferring kinetic energy into the 7f 80 - ~ = 0,P - P/= 0 base, where it vanishes in the inelastic coUision with the floor. Following impact, luxo extends forward while com- where 00 is the orientation of the base, P is the position of pressing slightly, dissipating the remaining momentum of the center of the base, and P/is a constant point on the flight, then rises smoothly to its pre-specified final pose.

165 SIGGRAPH '88, Atlanta, August 1-5, 1988

/ / /

Figure 4: A variation on the basic jump in which the contact force on landing is conscralned to be small. The force of impact is reduced by squashing just before land- ing, reducing the velocity and l:.ence the kinetic energy of the base. In contrast, the jump in Figure 3 ex- hibits a slight ~tretch before impact, producing an en- ergy-absorbing stomp.

L

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

something fragile. Figure 4 shows a relatively soft landing, generated under the same conditions as the basic jump except for the contact force constraint. Comparing the motion to the basic jump, we see that Luxo softened the blow of impact by squashing while moving toward impact, reducing the velocity, and hence the kinetic energy of the base. In contrast, the basic jump has a small atreteh before impact, producing an energy-absorbing stomp. The next variation has the same conditions as the ba- Figure 3: From top to bottom, a series of iterations sic jump, but the mass of the base has been doubled. The leading from an initial motion in which Luxo translates, final motion is shown in Figure 5. As expected, both the floating above the floor, to a finished jump in which aR anticipation and follow-through are exaggerated in com- the constraints axe met and the optimlzation function is pensation for the greater mass. minimized. The final motion shows marked anticipation, A final variation, shown in Figure 6, has the conditions squash-and-stretch, and follow-through. of the soft-landing jump, but with a hurdle interposed be- tween start and finish, and an additional constraint that Luxo clear the hurdle. As one would expect, the extra In the first variation on the basic jump, we add an height required is gained by squashing vigorously on ap- additional constraint fixing the contact force on landing. proaching the wall. The value we choose provides control over a hard-to-soft The jumping examples each took under 10 minutes landing dimension--a large landing force leads to an exag- to compute on a Symbolics 3640. While this is hardly gerated stomp, as if trying to squash a bug, while a small interactive speed, it constitutes a tiny fraction of the cost value leads to a soft landing, as if trying to avoid breaking of high-quality rendering.

166 Computer Graphics, Volume 22, Number 4, August 1988 I IIII ~ II IIIII I

Figure 8: Spacetime constraints: a cartoonist's view. (c) 1988 by Laura Green, used by permission. Figure 6: Hurdle Jump The initial condition for the optimizatior ~as ~ uni- form translation in the air above both the ski jump and the landing. In the first iteration, Luxo puts hi~ feeet on the ski jump and landing. By iteration 4, there is signifi- cant anticipation and follow through. Figure 7 is the result after 16 iterations. Both the ski jump and landing are built from two B- spline segments. The entire jump was computed with 28 time samples in the optimization. There were 223 con- straints and 394 state variables. The Jacobian contained 3587 non-zero entries, about 4~ of the total number of en- tries. The entire motion was computed in 45 minutes on a Symbollcs 3600.

VII. Discussion Figure 7: Ski Jump Our results show that spacetime methods axe capable of producing realistic, complex and coordinated motion given B. Ski Jumping only minimal kinematic constraints. Such basic attributes as anticipation, squash-and-stretch, follow-through, and Figure 7 shows Luxo d,~scending a ski jump. As in the timing emerge on their own from the requirement that the previous case, Luxo is constrained to be on the ski jump kinematic constraints be met in a physically valid way sub- and the landing at particular time samples. The biggest ject to simple optimizat.lon criteria. difference between the ski-jump and the infinite-friction The principle advantage of spacetime methods over goor of the previous example is that Luxo is free to slide~ simple keyframing is that they do much of the work that with the exact positions on the ski jump and the landing the animator would otherwise be required to do, and that left unspecified except at the top and bottom of the ski only a skilled animator can do Motions that would require jump. In addition, there is a constraint that the orientation highly detailed keyframe information may be sketched out of the base must be tangent to the surface it is resting on. at the level of "start here" and "stop there." This is a Both the ski jump and landing exert forces on Luxo. profoundly different and more economical means of control There is a normal force which keeps him from falling than conventional keyfrarning affords, an advantage that through and a frictional force which is tangent to the sur- easily outweighs the greater mathematical complexity and face and proportional to the tangential velocity. The coef- computational cost of the method. ficients of friction were state variables in the optimization. Beyond sparser keyframing, spacetime methods offer At one time instant while Luxo is in the air, the height really new forms of motion control. For example, we saw of his base is constrained. In addition, there is a term in in the previous section that constraints on forces, such as the objective function which gives him a preference for a the force of a collision, can be used in a direct and simple particular pose while in the air. This is a "style" optimiza- way to say "hit hard" or "hit softly," producing subtle but tion without which Luxo is content to go through the air very effective changes in the motion. in a bent position. Of the new opportunities for motion control, perhaps Luxo is also given pose constraints at the beginning the most exciting is the selection of optimization criteria and end of the motion. Unlike the previous jumps, how- to affect the motion globally, an area we have only begun ever, his initial velocity is unconstrained. to explore. With a little thought, it is clear that a magic

167 SIGGRAPH '88, Atlanta, August 1-5, 1988

"right" criterion, whether based on smoothness, efficiency [13] Pixar, Luzo, Jr., (film,) 1986 or some other principle, is unlikely to emerge and would [14] William Press et. al., Numerical Recipes, Cambridge in any case be undesirable. This is because the "optimal" University Press, Cambridge, Engiemd, 1986 way to perform a motion, as with any optimization, de- [15] Robert S. Stengel, Stochastic Optimal Control, John pends on what you're trying to do. Consider for example Wiley and Sons, New York, 1986. several versions of a character crossing a room: in one case, [16] , John Platt, Alan Barr, and walking on hot coals; in another, welklng on eggs; in an- Kart Fleischer, Elastically Deformable Models, Pros. other, carrying a full bowl of hot soup; and in still another, SIGGRAPH, 1987. pursued by a bear. Plainly the character's goals--and at- tendant cr~te~a of optimallty--are very different in each [17] Jane Wilhelms and Brian Barsky, Using Dynamic Analysis To Animate Articulated Bodies Such As Hu- case. We would hope to see these differing goals reflected in the motion. The possibility of controlling motion di- mans and Robots, Graphics Interface, 1985. rectly in terms of its goals, not just where it goes but how, [18] , Kurt Fleischer, and Alan Barr, En- is one we intend to explore. ergy constraints on parameterized models, Computer Graphics, 21 (4) July 1987, pp. 225-232 (Proc. SIG- References GRAPH '87). [1] William W. Armstrong and Mark W. Green, The dy- namics of articulated rigid bodies for purposes of an- imation, in Visual Computer, Springer-Verlag, 1985, pp. 231-240. [2] Ronen Barzel and Alan H. Barr, Dynamic Con- siraints, Topics in Physically Based Modeling, Course Notes, Vol. 16, Siggraph 1987 [3] Michael Brady et. el., eds, Robot Motion: Planning and Control, MIT Press, Cambridge, MA, 1982 [4] Charles E. Buckley, The Application of Continuum Methods to Path Planning, Doctoral Dissertation, Dept. of Mechanical Engineering, , Steax£ord, CA, 1985 [5] Kurt Fleischer and Andrew Witkln, A modeling testbed, Proc. Graphics Interface, 1988. [6] Philllp Gill, Welter Murray, and Margret Wright, Practical Optimization, Academic Press, New York, NY, 1981 [7] Michael Girard and Anthony a Maciejewski, Com. putataional Modeling/or the Computer Animation of Legged Figures, Proc. SIGGRAPH, 1985, pp. 263- 270 t8] Herbert Goldstein, Classical Mechanics, Addison Wesley, Reading, MA, 1950 I9] David Haumarm, Modeling the Physical Behavior of Flezible Objects, Topics in Physically Based Modeling, Course Notes, Vol. 16, Siggraph 1987 [10] Paul Isaacs and Michael Cohen, Controlling Dy- namic Simulation with Kinematic Constraints, Be- havior Functions and Inverse Dynamics, Proc. Sig- graph 1987, pp. 215-224 [11] Charles Klein and Ching-Hsiang Huang, Review of Pseudoinverse Control for Use with Kinematically Re- dundant Manipulators, IEEE Trans. SMC, Vol. 13, No. 3, 1983 [12] John Lasseter, Principles of Traditional Animation Applied to 3D Computer Animation, Proc. Siggraph 1987, pp. 35--44

168