Photorealistic fish #2: IK chaining and animation
A Lightwave Tutorial by Andrew Weiler

Before I begin I'd like to warn you about some of the occupational hazards of being a CG artist or animator. A couple months ago when I began building and animating the fish in this article I took a lot of time to research the look and motion of live aquarium fish. I spent a good deal of time in local pet shops and aquariums studying the movements of different fish. "Good deal of time" may be an understatement; on certain occasions I would find myself so engrossed in studying the fish, sketch book in hand, my nose pressed against the aquarium glass, eyes no doubt bulging with wonder—that the staff of the pet shop most likely thought I was seriously disturbed.

The fact remains that observation is very important. View as many reference sources as possible, be they books, videos, or (best) live specimens. When you come to the counter of your local video rental shop balancing a tall stack of documentary videos about tropical aquarium fish the clerk is bound to look at you a little strange, don't let it dissuade you. You can't expect to pull all the subtilities and nuances of weight, balance and timing out of your memory, so do your homework. Please note that this tutorial assumes a general working knowledge of bones, IK and motion graph editing in LightWave 5.0 or above.

IK Skeletal Setup

The first prerequisite to good animation is setting up a practical and usable IK bones system. Begin by setting a key at frame 0, this will be our "neutral" fish, the animation of the fish will begin on frame 2. By keeping frame 0 reserved you'll have the flexibility of going back and changing the bone setup without having to reset rotations and translations. Figure 1 shows the skeletal setup, all the bones are parented to the "root" bone at the head except the pectoral bones, which are part of separate pectoral fin geometry parented to the fish. The bottom fins use limited range to keep them from affecting the body of the fish. Finally, the two tailfin chains* (upper and lower) are parented to the bone marked "tailfin_root".

(* a "chain" refers to a group of bones parented to each other for IK purposes, i.e., bone2 parented to bone1, bone3 parented to bone2, etc. In LightWave this is accomplished easily by setting the position and rest length of the first bone, often called the "root", and pressing the + key to add child bones.)

Figure 2 shows the IK null effectors used to manipulate the bones. The bone marked "tailfin_root" in figure 1 is targeted to the null marked "tail_effector". The end bones on each tailfin chain are IK targeted at "tailfin_effector(1)" and "tailfin_effector(2)" respectively. "Tailfin_effector(2)" is parented to "tailfin_effector(1)", so that both IK chains can be animated with one null. You may also want to toggle off the visibility of "tailfin_effector(2)" for clarity.

Notice where the fish's pivot point is located. This is important because this is the fish's natural "center of rotation", and we'll be keyframing rotations on the fish before we animate with bones.

At the very front of the fish is a null marked "trans_null"; the fish is parented to this null which we'll use to keyframe gross translations and rotation. The "wiggling" movements of the fish will be keyframed on the fish object inself.

The next step is to set bone stiffness to falloff toward the tail, so that when the tail_effector is moved the fish will deform in an arc rather than a straight line. Figure 3 shows the bone stiffness settings along the spine of the fish. Similar stiffness settings were used for the tailfin chains, starting at 500% down to 1.0%. Now lets animate!

Animation

The first step to animating is to "block" the motion. Motion blocking is the stage where a character's gross movements, timing, and poses are created. Turn off visibility for all bones (scene panel), you may even want to switch to bounding-box mode for speed. Start by moving trans_null and setting keyframes for the fish's position in time and space, then go back and rotate the trans_null at each keyframe so that the fish follows the motion path. You could turn on "align to path" for trans_null so that the fish follows it's motion path automatically, but I've found keyframing the rotations produces better, more controllable results. Preview this motion and adjust it for timing and effect. Remember that it's a lot more work to go back and change the timing and staging after you've keyframed bone deformations, so establish the main choreography now. Figure 4 shows the motion path and keyframes I used for the fish. When you're satisfied with the overall movement and timing, select the fish object and start adding "wiggle" by rotating the fish on the heading and setting keyframes. This is the foundation upon which the bone motion will be built, so take time to get it right.


Figure 5 is a motion graph showing the final keyframes of the fish's heading rotations.

Once the bounding box has been previewed for timing accuracy, go back and add bone deformations. In essence, we'll be using the rotation keys we set on the fish object as a reference to keyframing the IK nulls marked "Tail_effector" and "Tailfin_effector(1)" each at opposite angles to make it appear that the muscle motion of the fish is traveling down the length of the body starting at the head and ending at the tail. Figure 6 shows an overhead of frame 9, notice that most of the motion is in the tail.

Starting at frame 47 the fish turns and swims away. This was a difficult motion to get right. It helps to always keep the anatomy and dynamics of the fish in mind. From observation of real fish you'll see that motion is very much lead by the head due to hydrodynamics, the fish has to "cut" through the water, with the body and tail following. Smaller fish also tend to turn by twitching their body 2 or 3 times in that direction, whereas large fish tend to move in with a more sweeping motion. Figure 7 shows the fish in a slight recoil as it anticipates the turn.

Lastly, add motion to the other fins. I used motion cycles for the dorsal and bottom fins, basically a side to side rotation on the heading axis, the bones staggered to provide for a ripple effect. The pectoral fins took a bit more time because cycling tended to make them look robotic. Figure 7 shows the extremes of the pectoral bones, four in each fin. They move in opposite directions back and forth helping to stabilize the fish. The arcing (called "follow through") is acheived by setting keyframes for the full bone chain, then going back and offseting the motion of the two end bones in the motion graph, so that they follow behind the motion of the first two bones.

Conclusion

Computer animation is a very iterative process, but always remember to leave room for spontaneity in your creations. Be full of your subject so that you can get a real feel the motion, and try to apply it in a straightforward fashion. The tendancy at times is to make too many revisions, which will suck the life out of your animation and make it dry and uninteresting. Also, saving multiple versions of your animation will help in that you can go be and see if you've overanimated. Happy animating!

Note that I've included a wireframe movie of the final fish animation with a running frame counter, which is locked to the frame count of the original animation, hence the start frame is 2. It's supplied in Quicktime (792k), AVI (843k) and MPEG (438k) formats for your viewing pleasure.

If you would like to see the final fish in an animation, we've supplied a short clip in Quicktime (1036k), AVI (1099k) and MPEG (439k) formats for your viewing pleasure. For information on the creation of the model and textures, see Part 1 of this series.


Andrew Weiler is a CG artist and technical director working in the Atlanta, Georgia area. When not producing animation, graphics and effects for companies like Bellsouth, AT&T, and GE you'll probably find him juggling his kids around, and trying to get some sleep.
http://www.mindspring.com/~aweiler/