Icon

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

Ready for Trailer

When we left off, we had just finished modeling the various pieces for our oh-so-exciting "cylinder going through a tube" masterpiece that, I'm confident, will earn us a much-deserved Academy Award nomination in the category of best Animated Short. It's just that good. Anyway, today we're going to move over to Layout, set things up, and apply Trailer so the cylinder will actually conform to the tunnel it will be traveling through.

To Layout we go

If you're just joining us, be sure to check out part 1, so you can get to the point where we are right now. We've just saved our object in Modeler and are ready to fire up Layout. Once Layout is running, let's load the Trailer plug-in. If you didn't happen to grab it from the link in part 1, go ahead and grab Trailer from the D-Storm Web site. Once you've downloaded it, unzip the archive and then move the Trailer.p file into your LightWave's plugins directory. It doesn't really matter if you stick it into one of the subdirectories or not (I stashed mine in the animate folder), but once it's there, head back to Layout, click the Utilities tab, and then select Add Plugins. Navigate to where you put the Trailer.p file, and click OK. LightWave should tell you that two plugins were loaded, and you're set up with Trailer.

Now it's time to pull in our tunnel object. Go to File:Load:Load Object and browse to wherever you saved tunnel.lwo. Once that's loaded up, the first thing to notice is that the default Camera and Light are rather large compared to the objects in the scene (fig. 1).


Figure 1

To fix this, just tap the left bracket key ([) a couple of times to get the grid size down to 500mm, which leaves us with things a little more in proportion (fig. 2):


Figure 2

Let's also give the sequence a few more frames to work with. By default, LightWave creates scenes that are 60 frames in length; double-click on the end frame field on the right side of the timeline and enter 120 frames as the length. With that done, it's time to move the Camera into position for our "beauty shot." Click the Cameras button at the bottom of the Layout window to select the default camera, and then click the Modify tab at the top of the Layout window to bring up the modification controls. Select the Move tool, and move the Camera to X:-4.2m, Y:3m, Z:-4.75m. Next, select the Rotate tool, and enter in H:40.00°, P:26.00°, B:0.00°. Now, hit the 6 key to switch to the Camera view, which should now look like Figure 3:


Figure 3

How Trailer works

Trailer, put as simply as I can, deforms an object according to another object's motion path. It has nothing to do with the shape of the followed object—only the shape of that object's motion path. The easiest way to create motion paths is by spawning a Null object and animating it over a few keyframes. We're going to go a step further right off the bat by having a Null object follow the curve we made last time.

Null, meet curve

The first thing to do to help things along is to make our curve visible. By default, you're not going to see it in Layout, but fortunately, there's a plug-in that comes with LightWave that will rectify the situation. Click the Objects button at the bottom of the Layout window, and then select the tunnel:curve object from the item popup list (fig. 4).


Figure 4

With the curve selected, hit the p key to bring up the Object Properties panel. Once the Object Properties panel is active, click the Geometry tab and then select the Show Curve plugin from the Add Custom Object menu (fig. 5).


Figure 5

Granted, since the tunnel object is completely surrounding the curve, this step isn't going to make a whole lot of difference, but making curves visible is a good habit to form anyway.

Now we need to make a Null object. The simplest way is to hit Control+N (on either platform), which will bring up the Null Object Name dialog box. Name the null motionNull, and click OK. You should now see a cross-shaped object smack-dab in the middle of the scene (where the cylinder is also residing for the moment). This is the object we're going to make follow the curve, so we need to head to the Motion Options panel and tell our newborn motionNull where to go. Click the Objects button, then select motionNull from the Items popup, and then hit the m key to open the MotionOptions panel. Down at the bottom of the panel is the Add Modifier menu; pull that down and select CurveConstraint. It should appear in the list directly below the Add Modifier, and once it's there, double-click the entry to open the CurveConstraint properties panel. Enter the options you see in Figure 6:


Figure 6

If you click the play button to preview the animation, you should see the motionNull flying through the tunnel (fig. 7):

Figure 7

We're going to take advantage of motionNull's newfound mobility by "attaching" its motion to the cylinder object via Trailer. Once again, click the Objects button, and this time select tunnel:cylinder as the active object from the Items popup list (or, I suppose you could just click on it directly to select it—that works too). Hit the p key to open the Properties panel, and then click the Deform tab. Next, pull down the Add Displacement menu and select Trailer (which should be near the bottom of the list, fig. 8).


Figure 8

Once Trailer has been added to the Displacement list, double-click on its entry to bring up the Trailer controls (fig. 9).


Figure 9

For the moment, let's concentrate on the two most important things. One, you have to tell Trailer which motion path to follow, so pull down the Target Item menu and select motionNull. Next, you have to select the correct axis for Trailer to use for the deformation. Pick the wrong one, and you could get pretty ugly results (fig. 10):


Figure 10

Since the cylinder was constructed with it running lengthwise along the Z axis, that's the one to use, and will produce something close to the expected result (fig 11):


Figure 11

Couple problems, though. One, our cylinder looks a little, shall we say, stretchy. By default, Trailer applies a span of 1 to whatever object you apply it to, which in this case stretches out the cylinder. You can tweak that number however you like, but in many cases you'll want to take the easy road and just tick the Keep Length checkbox, which will change the Span field to a percentage field with an initial value of 100%.

The next issue is that the cylinder starts out the sequence as a flat disc and then grows into the specified size (fig. 12). This is easily rectified by unchecking the Compressed at Start box. A related problem is that the Compressed at End doesn't seem to do anything (not sure why that is), so unchecking it is probably a good idea as well.


Figure 12

The last problem usually comes in the waning frames of the sequence. By default, Trailer will use the source motion path's number of frames as the length of the effect. However, Trailer seems to have some trouble closing the deal, so to speak. In the case of our cylinder, the end is less than smooth (fig. 13). The workaround is to make your source curve extend a little further than you need it to go (or trim a few polys off of the end of the tunnel object after the initial Rail Extrude), have the motionNull follow that curve for a few more frames than is necessary, and then use Trailer's Specify End box to set the end frame to a point where things will wrap up a little more smoothly.


Figure 13

With those few tweaks, we finally have a smooth animation through the tunnel (fig. 14):

Figure 14

In a nutshell, that's how Trailer works. However, we've somehow managed to ignore the entire lower half of the Trailer settings, so let's briefly see what's going on there.

Fun with rotation and scale

I've created an entirely new object to illustrate the Use Rotation and Use Scale settings in Trailer (fig. 15):


Figure 15

It's just a simple text object extruded out and diced into nice little chunks using the Julienne tool so there are enough polys for Trailer to deform it smoothly. I used the same process, curve, and motionNull that was used with the cylinder. This time, though, I've added a second null, animated its scale and rotation over the course of the sequence, and told Trailer to use its rotation and scale settings in the deformation (fig. 16):

Figure 16

As you can see, the text corkscrews around and scales larger in the middle part of the sequence. Pretty simple stuff, but it's best to see it in action than to get even more long-winded about it than I already have.

One thing to watch out for

We've previously discussed some of the issues that Trailer can specifically introduce, but there are a couple more things to remember in general when deforming objects like this (using Trailer or not). First, beware of smooth shading. With the Julienne tool, chances are that you'll have enough geometry to be able to have smoothing turned off for the surface you've applied to your object. The right half of Figure 17 shows the ugly result of the text object with smoothing enabled on its purple surface, and the left half shows the same object with smoothing off:


Figure 17

And with that final warning out of the way, that pretty much does it. While LightWave may not have absolutely everything and the kitchen sink included out of the box, you're generally never far from a plug-in that can pick up the slack. In this case, it's Trailer to the rescue, providing a simple and functional solution to a relatively common problem.

^ Top of Page

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