## Friday, June 19, 2009

### LightWave: Animation Along a Predefined Path

Introduction

A common task in 3D animation is to move an object along a path: snake curling up a tree and paper rolling on a conveyor belt, to name a couple. If the object were stiff, in NewTek LightWave you could create the path as a spline in Modeler and use Curve Constraint modifier in Layout. But that won't work with the snake or the paper. For those, you could mess with the likes of Curve Conform displacement, but they're hard to control. So, what do we do?

An old (but ingenious) trick does this with bones and morph. It works like this:
1. Create a morph for the object to move it along a long straight line
2. Rig the object with a chain of bones that follows this line, with the object at one end
3. Select Use Morphed Positions for all the bones
4. Reshape the bone chain as necessary
5. Move the object using Morph Mixer
As the object moves along the chain, the reshaped bones will deform the object to follow the new path rather than the original straight line. The magic here is coming from "Use Morphed Positions."

Case closed, right? Not quite. What if you want the object to follow a detailed predefined path? Like the conveyor belt. It would be tedious, if not impossible, to reproduce the path accurately by directly manipulating the bone chain in Layout.

We need to adapt the process, and that's what this tutorial is about. You'll be needing LightWave, though you can probably use the technique also in other apps (like Maya or Max). I used it in a little story of a fish in the sea; below is a simplified version of the shot in which the fish swims in a helical path.

For pictures showing the different steps, click on the Picasa Web Albums icon above.

Make the Path

First, we create the path that the object will follow. This will be a skelegon tree that we can convert to a bone chain in Layout.
1. Create a helix curve. I made it like this: create a point at X=3', clone 72 copies of it (shortcut c) by stepping the heading by 30° and Y by 2". That gave me a helix with 6' dia, 2' pitch, and 12' length.
2. Convert to skelegons. This is easy: just run Convert Skelegons.
3. Optionally, model a tube from the curve.
Set Up the Object

Next, we align the object with the path.
1. Orient the object in the +Z direction.
2. If necessary, resize it to fit within the path (and tube).
3. In the XY pane, align the object center with the start of the skelegon tree.
4. Create a morph (call it "Move") that moves it a long way along +Z (imagine the skelegons stretched out). The exact length isn't critical because we're going to adjust this in Layout.
Animate

Finally, we put it all together in Layout:
1. For the layer with the object and the skelegon tree, generate bones with Convert Skelegons into Bones. Let's call this object the "original."
2. Make a clone of this object and disable/hide it. This will be the "clone."
3. With Parent in Place set to On, parent the tube (if you have one) to the first bone in the original.
4. In the original, select all bones and (a) set HPB to 0 (b) mark as rest position (shortcut r) (c) select Use Morphed Positions (in property panel).
5. Open Scene Editor and copy the properties of all the bones except the top in the clone (click on the cells in Dope Sheet frame 1 and Right Click->Copy). Paste them to corresponding bones in the original (Right Click->Paste over).
6. For the original, add a Morph Mixer displacement and keyframe the "Move" morph so the object just enters and exits the path over the duration you want.
7. Unparent the tube, parent the original to the tube, and set the tube HPB to 0. This will get you back to the original orientation.
That's it, you're set. Play the timeline, and you'll see the object move precisely through the path (and the tube, if you have it).

#### 1 comment:

Levi said...

Very thhoughtful blog