Let It Flow! Learning Liquid Animation In the Sewer

by Greg Wilson

Creating an organic effect, as opposed to something that is or looks artificial, can be one of the trickiest techniques for a 3D modeler and animator. Not only is creating the effect a challenge, but so is designing a specific technique that can be used repeatedly for different situations. One organic effect that looks complicated at first is running liquid with random trails and drippings. This effect could be used for numerous situations: a waterfall, milk spilling over the edge of a table, water sheeting down a wall, or as in this tutorial, sewage flowing out of a pipe.

For this tutorial, I began designing a scene that would use water. Using the Transparency texture (Surfaces panel) on your object can dramatically slow down the rendering process. Couple that with Trace Refraction (Camera panel) and you'll be waiting a great deal longer for your scene to render. The effect can be worth the wait, but for the sake of making this tutorial, it's the movement of the liquid that's important, not the liquid itself. Besides, sewage is everywhere--let's have fun with it.

The Pit

Designing our sewer will be easy enough. For those of you just learning LightWave, I will outline everything I did step-by-step so we can produce the exact same scene. Before you begin, you should create two directories. Call both of them Sewerbut place one in the Objects directory, and the other in the Scenes directory.

Our first object to create will be a box that represents the walls of the sewer, so go into Modeler, Select Box (Objects panel) and click the Numeric button (n). Enter these values:
Low
X= -61cm
Y= -1m
Z= -91cm
High
X= 61cm
Y= 1m
Z= 91cm
Segments
X= 1
Y= 1
Z= 1

Click Make (Objects panel or Enter).

Either select all the polygons on the box or leave them all unselected.

Select Flip (Polygon panel or f).

Highlight only the top polygon as shown in Figure 1.

Select Surface (Polygon panel) and name it PitGrid.

Invert the highlighted selection

Select Surface (Polygon panel) and give it the name PitWalls.


Figure 1

You now have your sewer pit, but before you save it you must accomplish a few more steps. From Whence The Stench Comes

It's time to design the tube the sewage will pour from.

Go to layer 2.

Select Disc (Objects panel), click the Numeric button (n) and enter these values:
Axis= Z
Sides= 32
Segments= 1
Bottom= 70cm
Top= 2m
Center
X= 0
Y= 40cm
Z= 1.35m
Radii
X= 18cm
Y= 18cm
Z= 65cm

Click Make (Objects panel or Enter) to create the tube.

Next, use this tube to create a hole in the wall of the pit for a pipe to go through.


Figure 2

Make layer 1 the active layer and layer 2 the background layer, as shown in Figure 2.

Select S to Drill (Tools panel or C).

Select Tunnel, and click OK.


Figure 3

You've cut a hole in the pit for the tube to go through, as shown in Figure 3. Now let's make a second tube. You need the second tube to cut a hole in what is a solid cylinder in layer 2.

Go to layer 3.

Select Disc (Objects panel), click the Numeric button (n) and enter these values:
Axis= Z
Sides= 32
Segments= 1
Bottom= 68cm
Top= 1.99m
Center
X= 0
Y= 40cm
Z= 1.335m
Radii
X= 16cm
Y= 16cm
Z= 65.5cm

Click Make (Objects panel or Enter) to create the second tube.

Go to layer 2 and select layer 3 as background layer, shown in Figure 4.

Select Boolean (Tools panel or B), then select Subtract and click OK. You can see the result in Figure 5.


Figure 4


Figure 5

Now you've made what looks like a tube. Notice we didn't create a hole in the back of the tube--this is so the camera won't see through the tube in Layout if positioned to do so. Let's go ahead and clean up a little, then finish our sewage pipe.

Go to layer 3 and delete this object, just to tidy things up.

Go back to layer 2 and only select the rear polygons towards the +Z axis of the view, as shown in Figure 6.

Select Surface (Polygon panel) and apply the name SewagePipeEnd.

Invert the highlighted selection.

Select Surface (Polygon panel) and name the rest of the tube SewagePipe.

Select the entire object and click Cut (x).

Go to layer 1 and click Paste (v). Figure 7 shows the finished object.

Export your object to Layout, or select Save As (Object panel or S) and save the object as Sewer.lwo.


Figure 6

Pouring It Out

Now let's create our slimy sewage! You'll need to think ahead about how to use metamorph to create the look you want for the sewage. Create one object for the surface to go on, then another object that the first object will be forced to take the shape of. If using metamorph is unclear to you, perform the Advanced Tutorial #3 in the LightWave 3D User Guide. The rings are a good example.


Figure 7

Go to layer 2.

Select Box (Objects panel), click the Numeric button (n) and enter these values:
Low
X= -15.494cm
Y= 34cm
Z= 40cm
High
X= 15.494cm
Y= 36cm
Z= 1.99m
Segments
X= 15
Y= 4
Z= 80

Click Make (Objects panel or Enter), (Figure 8).

Click Triple (Polygon panel or T).

Select Surface (Polygon panel) and enter the name Slime.

Export this object to Layout or select Save As (Objects panel or S) and save the object as Slime.lwo.


Figure 8

This object will be used to apply the texture to the slime. Now you need to create the object's metamorph target. To do this, add some round edges and bend the object into the appropriate shape. You can either follow the lengthy series of steps listed below, or try your own technique to get a similar look.


Figure 9

Drag open the Side view so only it is showing.

Highlight the first 17 rows of polygons on the left of this view near the -Z axis as shown in Figure 9, and click Hide Uns (Display panel or =).

Press the (/) key to deselect the highlighted polygons.

Drag open the Face view so only it is showing.

Press the (a) key.

Select the points on each of the four corners, as shown in Figure 10.


Figure 10

Drag open the Top view so only it is showing.

Press the (a) key. Take a look at Figure 11 to get an idea of what we're doing.


Figure 11

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .99. Click OK.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .99. Click OK.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .98. Click OK.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .98. Click OK.

Deselect all the points by pressing the (/) key.

Drag open the Face view so only it is showing.

Press the (a) key.

You need to highlight four points again, two on the left and two on the right. You also need one down from the top and one up from the bottom from what was previously selected, as shown in Figure 12.


Figure 12

Drag open the Top view so only it is showing (Figure 13).


Figure 13

Press the (a) key.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .99. Click OK.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .99. Click OK.

Now deselect the top two highlighted points.

Select Stretch (Modify panel), click the Numeric button (n) and change only the X value to .99. Click OK.

Go to polygon selection and highlight all the visible polygons (17 rows).

Select Unhide (Display panel or \).

The slime should now be appropriately tapered for it's exit from the pipe. The next series of steps you need to perform in Modeler will bend a portion of the object into a 90 degree curve to create the pouring effect. This is easily accomplished by using the Bend tool (Modify panel) on selected polygons, but I will outline the old fashioned way below for those of you with really old versions of Modeler.

Make sure you're in the Left view only and that the first 17 rows of polygons near the -Z axis are highlighted.

Select Rotate (Modify panel or y), click the Numeric button (n) and enter the following:
Axis X
Angle 15
Center
X= 0
Y= 35cm
Z= 73.8cm

On the right side of this view, deselect row 17 only.

Select Rotate (Modify panel or y), click the Numeric button (n) and enter the following:
Axis X
Angle 20
Center
X= 0
Y= 34.5cm
Z= 71.85cm

On the right side of this view, deselect row 16 only.

Select Rotate (Modify panel or y), click the Numeric button (n) and enter the following:
Axis X
Angle 25
Center
X= 0
Y= 33.35cm
Z= 70.25cm

On the right side of this view, deselect row 15 only.

Select Rotate (Modify panel or y), click the Numeric button (n) and enter the following:
Axis X
Angle 30
Center
X= 0
Y= 31.6cm
Z= 69.25cm

Deselect the highlighted polygons by pressing the (/) key.


Figure 14

The liquid should now curve (Figure 14) into a right angle from it's original position. Go ahead and lengthen the 14 rows of polygons that are hanging down from the rest. Starting from the top, gradually make the spaces within the polygons greater than the row above to create the impression that the slime is accelerating as it falls. To do this, use the Magnet (Modify panel) to pull the polygons downward. Center the magnet a good distance below the polygons and make the magnet extremely wide on the X axis, then make the magnet wider than the polygons, according to the Left view. Pull the magnet downward dragging the polygons. You can try this on your own, or use the steps given below.

Select Magnet (Modify panel), click the Numeric button (n) and enter the following values:
Axis X
Radius
X= 0
Y= 81.3cm
Z= 30cm
Center
X= 0
Y= -49.7cm
Z= 69.2cm
Offset
X= 0
Y= -1.45m
Z= 0

Click Apply (Modify panel or Enter) and you'll see that the downward traveling polygons have been lengthened, as represented in Figure 15.


Figure 15

Export this object to Layout or click Save As (Objects panel or S) and save this object as SlimeTRGT.lwo.

Leave Modeler and go into Layout where you'll set up the scene and give your objects the necessary details.

Select Load Object (Objects panel) and load the object Sewer.lwo located in the Sewer directory.

Repeat the loading process for the objects Slime.lwo and SlimeTRGT.lwo.

Because the object SlimeTRGT.lwo was the last one loaded, it should be listed as the Current Object (Objects panel). Under Object Dissolve, change it from 0 to 100 percent so this object won't be visible in the scene.

Switch the Current Object (Objects panel) to Slime.lwo.

Enter 100 percent as the Metamorph Amount (Objects panel).

Switch the Metamorph Target (Objects panel) to SlimeTRGT.lwo.

Now the flat version of the sewage will be forced into the shape of the tapered and curved version. To give your sewage the dripping and streaming look, use the Clip Map on the Objects panel to cut out certain areas. Use a Clip Map instead of a Transparency Map to help speed up rendering time. You can also add a Texture Falloff rate that will allow only the areas beyond the pipe to be cut out. Just remember that you'll be applying all the surface attributes to the object Slime.lwo because SlimeTRGT.lwo will be invisible to the camera.

Click the T button beside the Clip Map (Objects panel), select Fractal Noise as our Texture Type, then enter the following:
Texture Size
X= 0.02
Y= 0.0001
Z= 0.08
Texture Falloff
X= 0
Y= 0
Z= 295
Texture Center
X= 0
Y= 0
Z= 0.4
Texture Pattern Velocity
X= 0
Y= 0
Z=- 0.015
Texture Value=150

Select Use Texture (Clip Map panel).

Now your sewage looks like it's dripping and streaming, so it's time to add a little color to your object by going into the Surfaces panel.

Select Slime as our Current Surface (Surfaces panel).

Select Surface Color (Surfaces panel), enter the following values:
Surface Color
Red= 43
Green= 108
Blue= 0

Select the T (Texture Map) button beside Surface Color (Surfaces panel) and put Fractal Noise as your Texture Type, then enter the following:
Texture Size
X= 0.01
Y= 0.01
Z= 0.03
Texture Velocity
X= 0
Y= 0
Z= -0.015
Texture Color
Red= 54
Green= 56
Blue= 46
Contrast= 0.6.

Select Use Texture (Color Texture panel).

In the Surfaces Panel, enter these values:
Diffuse Level= 90%
Specular Level= 75%
Glossiness= High

Turn Smoothing on.

Turn Double Sided on.

Your sewage is complete and you should now apply surface values to theSewer.lwo object.

Select PitGrid as the Current Surface (Surfaces Panel) and under Transparency Value enter 100.

Select the T (Texture Map) button beside Transparency Value (Surfaces panel), select Grid as our Texture Type, then enter these values:
Texture Size
X= 0.1
Y= 0.1
Z= 0.1
Texture Value=0

Select Use Texture (Transparency Texture panel).

This Transparency Map will be used to cast the shadow of a grill over the sewer.

Select PitWalls as our Current Surface (Surfaces panel) and enter these values:
Diffuse Level= 90
Specular Level= 30

Select Surface Color (Surfaces panel) and enter these values:
Surface Color
Red= 75
Green= 75
Blue= 75

Select the T (Texture Map) button beside Surface Color (Surfaces Panel), put Veins as our Texture Type, then enter the following:
Texture Size
X= 0.2
Y= 0.2
Z= 0.2
Texture Color
Red= 55
Green= 55
Blue= 55
Coverage= 0.01
Ledge Level= 0.01
Ledge Width= 0.4
Bump Strength= -0.5

Select Use Texture (Color Texture panel).

Select SewagePipe as our Current Surface (Surfaces panel), then under Surface Color enter the following:
Surface Color
Red= 153
Green= 92
Blue= 54

Click the T (Texture Map) button beside the Diffuse Level (Surfaces panel), select Fractal Noise as our Texture Type, then enter these values:
Texture Size
X= 0.01
Y= 0.01
Z= 0.01
Texture Value 60
Frequencies 5
Contrast 0.3

Select Use Texture (Diffuse Texture panel) and turn Smoothing on.

Select SewagePipeEnd as the Current Surface (Surfaces panel) and change the Diffuse Level to 0.

You've finished your objects. Save them so they keep their attributes.

Go into the Objects panel and save each object over their original version.

A Little Ambiance

All you need to do now is set up your camera and light.

Turn Trace Shadows on (Camera panel).

Go back to the main window, click View Camera and Edit Camera (Main Window).

Select Move (Main Window), click the Numeric button (n) and enter these values:
Camera Position
X= 0.56
Y= 0.26
Z=- 0.36

Select Rotate (Main Window), click the Numeric button (n) and enter these values:
Camera Direction
Heading= -31
Pitch= -0.3
Bank= 0

Now create a Key Frame for your camera at frame 0. In the main window either press the (Enter) key twice, or select Create Key (Main Window) and click OK. Figure 16 shows what this view will look like.


Figure 16

Go to the Lights panel and change the Ambient Intensity (Lights panel) to 25 and the Light Type to Point.

Go back to Layout's main window, select Edit Light and click on the Numeric button (n). Enter the following:
Light Position
X= 0.92
Y= 3
Z=- 2

Create a Key Frame for our light at frame 0. In the main window either press the (Enter) key twice, or select Create Key (Main Window) then click OK. Go ahead and save the scene as Sewer.lws in the Sewer directory.

A Taste Of Things To Come

Finally, the scene is finished. You haven't touched the positions of the objects since they were created in Modeler in their proper positions. If you want to take a peek at what you've created, go into the Camera panel and select Medium Resolution with Antialiasing Off, then press F9 to render a sample image.

To get a good idea of how your slime flows, render a minimum of 90 frames. The pouring effect should be pretty convincing. To make this a little more interesting, add Luminosity to the Sewage surface and turn the Glow Effect on (you'll probably have to render a few frames to get the glow settings in the Effects panel right). If you have the time and/or a fast system, remove the Clip Map (Objects panel) for the Sewage.lwo object and enter the same values into a Transparency Map (Surfaces panel) for the Sewage surface. However, you'll probably have to experiment with the Texture Size, Texture Value, and Contrast values to get the results you want.

This pouring effect can be used in countless circumstances in a variety of ways by simply changing the shape, size, color, transparency, etc. I hope this technique will spark the imagination of at least one person out there. Keep imagining!

Greg Wilson is the owner of Dayhawk Productions in Sioux City, Iowa. Feel free to contact him by sending a letter to P.O. Box 264, Anthon, Iowa, 51004.