Dynamics and Particle Effects, Part 4

In this article-the last in this series on dynamics-I talk about the Ocean Shader, which is listed under fluid effects. I have found this shader to be a relatively simple way to create ocean or even pond looks. I decided to talk about this particular shader, because many of my students have tried to use it unsuccessfully, using it without really understanding how it works. The trick to getting good results with this shader is to understand its attributes. But you can use Ocean Shader for more than water: In the second half of this article, I show you how to create a flying kite using the powerful nCloth module in Autodesk* Maya*.

Creating Liquid Using Dynamics and Ocean Shader

In the Dynamics module, click Fluid Effects > Ocean > Create Ocean. In the Create Ocean window that appears, accept the defaults (Figure 1).

Figure 1.Notice that by default, there is a Create preview plane check box. Make sure this check box is selected and that the Preview plane size is 10.00.

Figure 2 shows the resulting window.

Figure 2.The resulting ocean shape and preview plane

The small grid in the center of the round ocean shape is the preview plane. This plane is for previewing purposes only and does not affect the final render. You can move and scale the plane, as necessary (Figure 3); wherever you move it on the ocean shape will be the part of the ocean you are previewing. If you scale the plane up and do not increase its resolution, you will be able to see more of the ocean but with less detail. If you scale the preview plane up and increase the resolution, you will be able to see more of the ocean with greater detail (depending on how great a resolution increase you apply). Once again, these changes do not affect the render of the ocean, only your preview viewing of it. Increasing the scale of the preview plane and its resolution will of course increase the time it takes to update your preview animation.

Figure 3.The preview plane on the left has its resolution in the attribute editor set at 20, while the one on the right shows more detail because it has its resolution set to 100.

Figure 4 shows a default render of the ocean before any settings have been changed.

Figure 4.Already the ocean looks fairly good. It is important to understand the attributes not only for the look but for the animation of the ocean. Remember: Changing the settings of the preview plane does not change the look of the render.

Attributes of the Ocean Shader to Work With

Figure 5 shows the Ocean Shader attributes you’ll be working with.

Figure 5.The attribute editor of the Ocean Shader with some of the more important attributes highlighted.

The Scale Attribute

One attribute of the Ocean Shader (not the preview plane) that can radically affect the look of the ocean is scale. If you increase the scale, you are creating a denser ocean. A decrease can make the same ocean area look like a pond. If you render the same camera view of the ocean with different scale settings, the image can look vastly different (see Figure 6).

Figure 6.The ocean on the left has a scale setting of 0.2; the ocean on the right has a scale setting of 10.

Keep the ocean scale at the default of 1 for this exercise.

The Wave Speed and Wave Turbulence Attributes

Wave speed is what it sounds like: the speed at which the waves are traveling. The default value of 1 is supposed to be the correct speed for open ocean waves based on the Maya* units and the Ocean Shader scale. Try changing the wave speed and playing it back. Look at the preview plane to get a good idea of how the ocean animation would look.

The waves obviously travel in a direction determined by values between 0 and 1, which you put into the Wind UV attribute. The U is one direction on the ocean plane, and V is the other. Because the Wave turbulence attribute adds randomness to the wind direction, turn it down to 0 from the default of 1. Now, changing the Wind UV values will give you the best idea of how the Wind UV works. Play back the animation: The wave direction will be clear (see Figure 7).

Put the wave speed back to the default of 1. Change the U and V values to make the wind blow in the direction you want. You can change these values to negative numbers to reverse the wind direction.

Figure 7.With the wave turbulence turned down to 0, the wind direction seen on the preview plane is apparent. The left side of the wave turbulence ramp represents the shortest waves; the right side represents the longest waves. In this way, the turbulence can be different for waves of different lengths.

A value of 1 represents the most turbulent the waves will be at a defined frequency. This value is calculated using multiple sine waves. By increasing the Num Frequencies values, you are actually adding more detail between the waves. In the Ocean Shader, when you adjust these attributes, you are adjusting noise textures. Adjust the Num Frequencies value to 6. Turn the turbulence value back to the default of 1 for all wave lengths.

The Wave Length Min and Wave Length Max Attributes

The Wave Length Min and Wave Length Max values control how long the waves are. No wave will be longer (more units) than the Wave Length Max value. If you decrease the Wave Length Min value, you can increase the detail by making more tiny waves (see Figure 8).

Figure 8.The image on the left has a Wave Length Max value of 4 and a Wave Length Min value of 0.3. The image on the right has a Wave Length Max value of 12 and a Wave Length Min value of 0.1.

The Wave Height Attribute

The ramp from left to right corresponds to wave length: From left to right, the ramp goes from short to long waves (see Figure 9). When the Wave Height value is 0, the wave has no height and blends into the ocean. You can create short waves that are tall and long waves that are high. Short waves that are tall add detail to the ocean.

Figure 9.The short waves on the left side of the graph have the lowest height, while the long waves on the right side of the graph have the highest values.

Render the values to see the result (Figure 10).

Figure 10.Render of the values in Figure 9.

Now, look at the schematic for the render (Figure 11).

Figure 11.The short waves on the left side of the graph have the highest height values, while the long waves on the right side of the graph have the lowest values.

Using the values shown in Figure 11, render the ocean again. Then try out different height values.

Figure 12.Render of the values in Figure 11.

The Wave Peaking Attribute

Once again, on the ramp for the Wave Peaking attribute, the shortest waves are on the left, and the longest are on the right. With a Wave Peaking value of 1, the tops of the waves are sharp; as you go toward 0, the wave tops become increasingly rounded. To better see it for yourself, put in a high wave height on the longest waves, and then put in a Wave Peaking value of 1 on the longest waves (Figure 13 and Figure 14).

Figure 13.The render on the right shows sharp wave tops on the longer waves. The longer waves have a Wave Peaking value of 1.

Figure 14.The render on the right shows rounded wave tops on the longer and shorter waves. The longer and shorter waves now have a Wave Peaking value of 0.160. Notice the horizon line-the thin dotted line. This line shows up when your camera is lowered into the waves. To prevent the horizon line from showing up, simply put a value of 0 into the Horizon Filter attribute. You can increase the Bump Blur attribute to smooth out any specular highlights.

Foam Attributes

Increasing the Foam Emission attribute makes the foam brighter by increasing its density. This attribute works in concert with the Foam Threshold attribute. When the Foam Threshold is 0, no foam shows. When Foam Emission is 0, no foam appears. There must be Foam Emission and Foam Threshold settings greater than 0 for foam to appear. Mapping the Foam Emission value so that there is no uniform foam brightness is also an option. Increasing the Foam Threshold value increases the area of the wave (starting from wave top down) that the foam covers. It also controls how long the foam lasts. The Foam Offset attribute adds uniform foam everywhere. A little bit of Foam Offset can brighten the entire ocean (see Figure 15).

Figure 15.The Foam Emission attribute has some noise mapped onto it. The Foam Threshold is set at 0.4.

Ocean Shader Color and Common Material Attributes

The Ocean Shader also has the some common attributes: Water Color, Incandescence, Ambient Color, and Diffuse. By default, the Refractive Index is set to 1.3, which is correct for water. There is also a Trough Shadowing attribute that darkens the diffuse color in the wave troughs (Figure 16).

Figure 16.In these images, I changed the water color a bit, added in some fog and a sky, and rendered it with Mental Ray using Final Gather.

Creating a Flying Kite Using nDynamics

Start out with some simple geometries to create a kite. First, create a long string by extruding a curve with a circle. Then, convert the string to a poly so that it can be turned into an nCloth item. In the nDynamics module, select the string, and then click nMesh > Create nCloth (Figure 17).

Figure 17.When you create the nCloth, you also create a nucleus1 with it. If a nucleus has already been created in the scene, you can choose to use a previously created nCloth or create a new one, which you do from the window when you create the nCloth, or change it later under nSolver > assign nSolver.


Create a nucleus that is the solver node carrying all the attributes that affect the whole solver system. A solver system can be in charge of many nCloth objects: You must adjust the nucleus solver properties to get the results you want. Later, I talk about the nClothShape node, which you must also adjust to get the type of simulation you want.

The nucleus is connected to the meter scale, so in the case of any forces such as wind or gravity found in the nucleus solver, they are applied as if the objects were scaled in meters (Figure 18). You adjust this value in the Space Scale attribute, which is found under the scale attributes in the Nucleus. When you set it to 1, the nucleus is scaled for meters.

Figure 18.The attribute editor of nucleus1. Notice that I have changed the Space Scale attribute from 1 to 0.1: This change should improve the behavior of the simulation. The Time Scale attribute in the nucleus node is in direct relationship to the time slider when set at 1. Use this value to speed up or slow down your simulation.

The nClothShape Node

Open the string’s attribute editor. In the Presets drop-down list, point to tshirt, and then click Replace (Figure 19).

Figure 19.Notice in the Notes section at the bottom of the attribute editor: Here you’ll find information about the preset selection you made.

Play the timeline, and watch how the string falls downward. This happens, because in nucleus1, which is the solver the string is assigned to, there is a default Gravity setting of 9.8, and the direction is -1 on the y-axis (Figure 20). Leave the Gravity settings for now.

Figure 20.In nDynamics, when you create an nCloth or nParticle, you have a choice whether to use the solver or nucleus already in the scene or creating another one. All items in a scene using the same solver will be affected by its settings and in the same way by all the forces in the scene assigned to them.

Now, create a locator, and place it at the left end of the string. Create another locator and place it at the other end of the string. Scale up the two locators so you can see them better (Figure 21).

Figure 21.The initial setup for the kite string.

Next, select the locator on the left (locator1) and the vertex on the left tip of the string, and click nConstraint > Transform (Figure 22). Now, when you run a playback, notice how the left side of the string stays in place as the rest of the string falls.

Figure 22.Close-up of the left side of the string with the locator and the vertex

Now, make a kite with some simple geometry forms (Figure 23). As always, it’s best to create geometries with an even distribution of faces and vertices so that the dynamics will operate evenly over the whole object.

Figure 23.The layout of the kite

Select the kite body and make it into an nCloth by clicking nMesh > nCloth. For now, use the tshirt preset. Parent the kite body to the crossbars, parent locator2 to the crossbars, and then parent the string to the crossbars. Click nConstraint > Transform for the right vertices of the string to locator2 (Figure 24).

Figure 24.Close-up of the vertices of the string and the locator2 they are constrained to

Next, click nConstraint > Transform for the vertices at the four kite body corners to the vertices at the ends of the crossbars (Figure 25). Do one corner at a time.

Figure 25.Close-up of the vertices of the kite body corners and the vertices at the ends of the crossbars

After you transform all four corners, play the scene. Gravity that affects all of the nCloth objects is still on in the nucleus, causing the movement. You will probably see some interpenetration of the kite body into the crossbars. To stop that, you select the crossbars and make them into a passive collider by clicking nMesh > Create Passive Collider (Figure 26).

Figure 26.The crossbars are now passive colliders.

Now comes the fun part. Go into nucleus1 and set the Gravity to 0 (Figure 27). Experiment with wind speed and direction in nucleus1, and look at the orientation of your kite. Decide on the wind direction.

Figure 27.You’ve created a rigging for the kite. Now, because you have everything parented together, you can key frame the position of the crossbars, and the kite body and string will go along with it. Try changing the presets of the nCloth kite body. Silk works well. Something to try in the future is making the crossbars into an nCloth object, as well, so they would have some bend and give.

Adding the Kite Tail

Add a tail to the kite by creating a poly object in the shape of the kite tail. Make it into an nCloth object. Select the kite tail, and then click nMesh > Create nCloth. Use the tshirt preset for the kite tail. Create a locator and place it at the bottom of the kite, just touching the vertical crossbar. Parent the locator to the crossbar. Then, select the locator and the top vertex of the kite tail, and click nConstraint > Transform. Now, the kite tail should follow the kite (Figure 28). Because the same solver (nucleus) was used on the kite tail as the rest of the kite, it will have the same forces acting on it.

Figure 28.The kite tail, because it is transform-constrained to the locator parented to the crossbar, will follow along with the kite as it flies, but it will ignore the gravity and wind of the nucleus/solver. Play the animation and see if you like the way the kite tail is moving.

To prevent the wind and gravity of the nucleus solver from affecting the kite tail, go into the nCloth attribute editor of the kite tail, and under the Scaling Relationship tab, select the Ignore Solver Gravity and Ignore Solver Wind check boxes (Figure 29).

Figure 29.Now the kite tail is flying along behind the kite, not being pushed in front of it by the wind in the nucleus solver that was set to a speed of 12 on the z-axis. Try your animation connected and unconnected to the nucleus wind.

In Figure 30, I have imported the kite scene into my ocean scene.


Figure 30.Now, the two animations play together.

For Figure 31, I imported the kite animation into my ocean scene. I set up a five-camera rig designed to shoot animations to be projected onto domes. I then took the renders from one frame taken by the five cameras and stitched them together into what’s called a dome master.

Figure 31.The kite animation imported into my ocean scene


In this four-article series, I barely touched upon what you can do with dynamics and nDynamics. Along the way, you have been introduced to some simple mel expressions. In part 1, I covered some of the basics of particle effects centering around the creation of smoke-a commonly used effect. In part 2, I introduced nParticles with smoke as well as collision effects using rain. Part 3 was an introduction to soft and rigid body dynamics as well as a bit of fun creating chocolate with blobby particles. In this last part of the series, I demonstrated an effective but simple way to create an ocean effect as well as introducing you nCloth, a powerful module that can be used for many varied effects. Here in Los Angeles, I’m tempted to head out the beach to fly my own kite.

About the Author

Audri Phillips is a Los Angeles-based artist currently working and exhibiting in a variety of media that range from computer animation and motion graphics to her more personal work, oil paintings and video art (visual poetry). She has worked for more than 20 years as an artist/digital artist in the entertainment industry in Los Angeles at such large studios as Disney Feature Animation, Sony Imageworks, DreamWorks Feature Animation, Rhythm and Hues, Digital Domain, and Electronic Arts as well as a number of small design boutiques. Her production experience includes art direction, design, visual development, storyboards, color and lighting, efx, layout, modeling, and compositing. Currently, she is an adjunct professor at Woodbury University. Check out her work at http://www.vimeo.com/audri/videos.