Read an Excerpt
Chapter 4
Advanced Algorithms
Animators are often more concerned with the general quality of the motion than with precisely controlling the position and orientation of each object in each frame. Such is the case with physical simulations; when dealing with a large number of objects; when animating objects whose motion is constrained in one way or another; or when dealing with objects in the background whose precise motion is not of great importance to the animation. This chapter is concerned with the algorithms that employ some kind of structured model approach to producing motion. The structure of the model automatically enforces certain qualities or constraints on the motion to be generated. The use of a model eliminates the need for the animator to be constantly concerned with specifying details of the motion. Instead, those details are filled in by the model. Of course, by using these models, the animator typically loses some fine control over the motion of the objects. The model can take various forms, such as enforcing relative placement of geometric elements, enforcing nonpenetration constraints, calculating reaction to gravity and other forces, enforcing volume preservation, or following rules of behavior.
Motion is produced by the combination of the constraints and rules of the model with additional control information from the user.
This chapter discusses both kinematic and dynamic models. Kinematic control ` refers to the movement of objects irrespective of the forces involved in producing the movement. For example, the interpolation techniques covered in the previous chapter are concerned with kinematic control. Several of the algorithms given here are also kinematic in nature, such as those having to do with the control of linked armatures. Dynamic control is concerned with computing the underlying forces that are then used to produce movement. Among the dynamic control algorithms are those that are physically based.
In the discussion that follows, kinematic models are covered first, then hierarchical models and the associated use of forward and inverse kinematic control. Rigid body dynamics and the use of constraints, which are primarily concerned with dynamic control, are then discussed, followed by techniques to control groups of objects. The chapter concludes with a discussion of animating implicit surfaces.
4.1 Automatic Camera Control
One simple example of using a procedure or algorithm for control is the specification of the position and orientation of the camera. Various guidelines are employed in the art of filmmaking for positioning the camera so as to capture conversation, follow action, and emphasize spatial qualities such as vastness or intimacy [6]. These guidelines primarily address aesthetic concerns; the discussion here focuses on basic computational models for calculating camera motion based on the geometric configuration of the elements in the scene.
Often, the animator is more concerned with effectively showing an action taking place than with getting a particular camera angle. When using high-level algorithms to control the motion of objects, the animator may not be able to anticipate the exact, or even general, position of objects during the animation sequence. As a consequence, it is difficult for the animator to know exactly how to position and orient the camera so that the important action will be captured in the image. In such cases, it is often useful to have the camera position and center-ofinterest location automatically generated for each frame of the animation. There are several ways to automatically set up camera control; the choice depends on the effect desired in the animation.
A common way to automatically control the camera is to place the camera position and/or center of interest relative to the positions of one or more objects in the animation. (A simplifying assumption, which will be used for now, is that the camera will maintain a head-up orientation during the motion.) A static camera can be used to track an object by attaching the center of interest to the object's center point. If a group of objects move together, then the average of their locations can be used as the cameras center of interest. This works as long as other moving objects do not get in the way and the object (or group of objects) of interest does not move too far away.
The camera can closely follow a widely roaming object by locating the position of the camera relative to the moving object. For example, a constant global offset vector can be used to position the camera relative to the center of interest; the offset vector can also be relative to the tracked object's local coordinate system. Sometimes it is useful to constrain the cameras position to a predefined plane or along a line segment or curve. The closest point on the constraining element to the center of interest can be calculated and used as the camera location. For example, in some situations it might make sense to keep the camera at a specified altitude (constrained to be located on a plane parallel with the ground plane) so that it can capture the action below. Other constraints can also be used, such as distance between the camera position and the center of interest and/or the angle made by the view vector with the ground plane.
Such precise calculations of a camera location can sometimes result in movements that are too jerky if the objects of interest change position too rapidly. If the camera motion can be precomputed (the animation is not being generated interactively or in real time), then smoothing the curve by averaging each point with some number of adjacent points will smooth out the curve. Attaching the camera or center of interest with a spring and damper, instead of rigidly, can help to smooth out the motion. For example, to track a flock of birds, the center of interest can be attached to the center of the flock and the camera can be attached by a spring-damper combination (see Section 4.3 for a discussion of modeling dynamics and Appendix B for the basic equations of motion) to a location that is to the back and side of this position.
It is useful during animation development to define cameras whose only purpose is to inspect the motion of other objects. A camera can be attached to the front or "over the shoulder" of an object moving in an environment, or it can be attached to a point directly above an object of interest with the center of interest coinciding with the object. To check facial expressions and eye movements, a camera can be positioned directly in front of an object with the center of interest positioned on the figure's face.
Although automatic control of the camera is a useful tool, as with most automated techniques, the animator trades off control for ease of use. Efficient use of automatic control requires experience so that the quality of the results can be anticipated beforehand.