Icon

Deformation Along a Path in LightWave[8], Part 1

Let's get our project prepped for some good old-fashioned mutilation

LightWave is one of those programs that is heavily dependent on plug-ins, so when you hit upon something that LightWave can't easily do by itself, it's not real difficult to find a plug-in to pick up the slack. One particular shortcoming that frustrates many a LightWaver is that while you can have an object follow a motion path, there's no real built-in way to have an object deform along the path it's following. But fret not: there's a darn good plug-in that will ultimately save the day, and it's free to boot. Let's check it out.

First thing's first: huh?

Let me elaborate a little more on the issue at hand. If you're doing a space battle (for example), you're probably dealing with solid objects like ships and asteroids and stuff. So, if you want to have a ship follow a curve you've drawn, LightWave conveniently offers a built-in way to do this (through the CurveConstraint motion modifier). While we're not going to be getting into that technique in very much detail (be sure to check out Newtek's own tutorial on this process if you're unfamiliar), we will be building upon that functionality and taking it one step further.

But what if you're trying to animate something like a cylinder moving through a pipe? This isn't exactly a unique problem; everything from a slithering snake to blood moving through an artery requires deformation along the object itself according to a preset motion path, and the CurveConstraint modifier isn't going to help you with that at all. Figure 1 shows the problem of relying solely on CurveConstraint:

Figure 1

Folks, that ain't gonna do it. Since the object has to conform to the geometry of the pipe as it moves through it in order to believable, it would be nice if we could end up with something like this (fig. 2):

Figure 2

Unfortunately, there's still no easy way to do this using just the base install of LightWave. When I had this very problem during a medical animation project I was working on a couple years back, I was finally able to track down a relatively obscure plug-in called Psycho-Graph that would deform objects along a path like in Figure 2. It had several problems, though. One, it was in Japanese, and what with the small issue of me not understanding Japanese, it took a while for a mere Yank like me to figure it out. Two, it was kind of limited, requiring some precise placement to get the effect I wanted. Three, it was for the Windows version of LightWave only, meaning that I couldn't open the project on my Mac even if I wanted to. Four, and admittedly not a problem at the time, it seems to have disappeared. Fortunately, there's another option: Trailer from D-Storm. It's cross-platform, it's got an English version, and (most importantly) it's free. It's a little light on documentation, though, but it's pretty easy to figure out. First, however, let's head to Modeler and build the various objects we'll ultimately need to illustrate how Trailer works.

Gather the pieces

We're not going to get too terribly detailed with putting together the objects we need, since it's not really necessary for you to follow what I'm doing very precisely—it's the concept that's more important than the specific execution. The first thing we're going to do is fire up Modeler and make a curve. The easiest way is to use the Spline Draw tool (located under the Create tab) to make a series of points, and then drag them along the Y-axis for some height randomness. Figure 2 shows my curve once I was done:


Figure 3

Now, click on Layer 2 in the Layer Bank, and create a flat disc, one that's small enough to make a relatively slender tunnel in relation to the curve we just made. Copy and paste that disc into Layer 3 for later use. Click on Layer 2 again to select it as the active layer, and then click on the bottom half of Layer 1 to put the curve into the background. Then, position and rotate the disc in Layer 2 so it lines up with the placement and direction of the beginning of your curve (fig. 4):


Figure 4

Leave the layers in the state they're currently in (Layer 2 active, Layer 1 background), and select the Rail Extrude Tool (located under the Multiply tab). Leave the settings at their default values (fig. 5) and click OK to create the tunnel (fig. 6).


Figure 5


Figure 6

Next, select the polygons at either end of the tunnel and delete them, which will give us openings at each end for the cylinder to ultimately enter and exit. Add a surface to the tunnel, using settings similar to what is shown in Figure 7:


Figure 7

Now that we've got our tunnel ready, let's get the cylinder going. Click on Layer 3, where you should have a copy of the disc you made the tunnel out of. Using the Scale tool, scale the disc down to about 80% of its original size (we're doing that so the final cylinder won't be too snug inside the tunnel and cause rendering collisions as the tunnel surface and cylinder surface fight it out for dominance). Now, rotate the disc 90 degrees so that it's facing you in the Back view. Next, extrude it out (distance doesn't matter; I did it to a length of 1 meter), then hit the F2 key to center the cylinder in the window. Add a run-of-the-mill surface to it (I did a specular purple, but it doesn't matter), and then select the disc on either end of the cylinder. Cut the selected polys and paste them right back in—this will make sure the smooth setting on the surface won't affect the ends of the cylinder, which it might have if we had left the ends connected to the round edges of the cylinder. When all that is done, you should finally be left with what you see in Figure 8:


Figure 8

Pump up the polys

Time for a bit of an aside. If you look a little closer at Figure 8, you'll notice that the disc has plenty of points around its circumference to make for a nicely rounded cylinder, but if we try to do anything with it as it is right now, we're going to have some serious issues if we try to animate it moving through the tunnel using Trailer. Take a look (fig. 9):

Figure 9

Since the body of the cylinder doesn't have any additional geometry, and the Trailer plug-in is attempting to bend the cylinder to the curve of the tunnel, the cylinder simply doesn't have the polygons to negotiate all the twists and turns. Therefore, we're going to need to add some extra segments along the cylinder's Z-axis to make sure things get smoothed out once we apply Trailer. For that, we need the Julienne tool.

So, back to Modeler. With the cylinder layer active, click on the Multiply tab and then pull down the "More" menu located in the Subdivide section. Select Julienne from the menu, and enter in the following settings (fig. 10):


Figure 10

Once that operation completes (which should be more or less instantaneous), you should have plenty of geometry to work with, as shown in Figure 11:


Figure 11

Before we wrap things up for today, a bit of housekeeping. One, for some reason, the Julienne tool never cleans up after itself, so you should have an extraneous layer of squares somewhere in an upper Layer Bank (mine was on Layer 11, as shown in Figure 12). Find this rogue layer and eliminate it with extreme prejudice.


Figure 12

Lastly, open up the Layers window (the F7 key will activate it) and name your layers. This isn't strictly necessary, but it will definitely make things easier when we move over to Layout and start putting the Scene together. Use Figure 13 as a cheat sheet:


Figure 13

Save your object as tunnel.lwo, and that's it for today. Next time we'll move over to Layout and set things up so Trailer can do its magic. Until then, everyone!

^ Top of Page

Got Feedback? Click here to send an email. I'll do my best to answer. Really.