Offset Null Entertainment, LLC Software and Graphic Design Solutions

8May/11

Simulate Water with Flex in 3ds Max 2012

Water Ripples using Flex in 3ds Max 2012

Water Ripples using Flex

With Reactor removed from 3ds Max 2012, users will now need to explore other means of animating physical simulations. This tutorial will cover replacing Reactor's water simulation using Flex, a tool already available in 3ds Max. While you could simulate general water movement or ripples using the Ripple modifier or the Waves Standard Map applied to a Displacement modifier, these options require manual animation and can't be affected by dynamic collisions. Flex, which you may have used to add jiggle to fat characters, simulates soft-body dynamics using springs. It's a very powerful modifier which can be affected by forces and deflectors to simulate cloth, rope, water, and other soft-body dynamics.

Simulating ripples from dropping objects

  1. Create a 150x150 plane, with 20 length and width segments and label it Water Plane. We'll increase the segments later, but for now, 20 segments will provide us with a reasonable estimate of the final product without slowing down your computer too heavily.
  2. Add a simple sphere to the world, give it a radius of 10, and label it Dropped Object.
  3. Now lets animate the sphere dropping through the Water Plane. You could also use MassFX or another Flex modifier to cause the sphere to drop automatically, but for this tutorial, we'll just animate it by hand.
    1. Turn on Auto Key and go to frame 0.
    2. Move the Sphere above the plane to a reasonable starting position (say z=80).
    3. Go to frame 20 and move the sphere below the plane.
    4. Turn off Auto Key and click play. The sphere should move through the water plane at a reasonable pace, but the animation doesn't look quite right. This is because the default tangents are likely set to Auto.
    5. Right click the Key Frame at frame 0. Choose Dropped Object: Z Position and change the Out tangent to Slow.
    6. Select the Key Frame at frame 0, and change the Dropped Object: Z Position In tangent to Fast. This will cause the sphere to speed up as it drops as though it were affected by gravity.
  4. Next, add a UDeflector or UOmniFlect to the world and pick the Dropped Object. This Deflector will be what causes the Water plane to ripple. Flex supports all default deflectors that come in 3ds Max 2012.
  5. With the scene fully configured, now the fun happens. Select the Water Plane, go to frame 0, and make the following changes:

    Steps 5-a to 5-g. Settings used to achieve a water effect using Flex

    1. Parameters - Strength: 0.1
    2. Parameters - Sway: 0.1. A low strength and sway make the Flex object act like a liquid.
    3. Simple Soft Bodies - Stretch: 5.0. A higher stretch value will make the ripples propagate faster, but can also increase the wave amplitude to comical proportions.
    4. Simple Soft Bodies - Stiffness: 7.0. If your stiffness value is too low, the water will lack volume and vertices wont be affected by the dynamic simulation until the ripple reaches them, decreasing the speed at which the ripple spreads. Too high and your water plane will fall from its original position like a levitating piece of cloth or simply explode.
    5. Forces and Deflectors - Deflectors - Add the collision deflector from above.
    6. Select the Weights & Springs Sub-Object (or press 3). You'll notice that the center of the object has a higher weight than the corners. Select all the vertices and enable Weights and Painting - Absolute Weight. Then decrease the vertex weight to 0.1. All vertices should now be blue.
    7. Finally, we need to create the springs which drive the animation. Click the Create Simple Soft Body button. And your water plane is complete!

Add a TurboSmooth modifier to the stack to decrease the jagged ripples. If you want to increase the resolution of the original plane, you'll need to recreate the springs and adjust the weight for the new vertices by repeating steps 5-f and 5-g, above. If the ripple amplitude is too high or too low, adjust the Parameters - Flex value.

Baking the flex animation

Flex can really slow your system down, especially with a high resolution plane and collision detection. If you want to preview the Flex dynamic animation in real-time, you'll need to cache the vertex animation using the Point Cache modifier.

  1. Select the Water Plane and add a Point Cache modifier to the stack.
  2. Create a new cache file with your scene.
  3. Under record, make sure the end frame expands the length of your animation, then click Record.
  4. When processing completes, click the Disable Modifiers Below button. If Flex is still active while you're trying to preview the animation, Max will continue to calculate the Flex dynamics and slow down your computer.

If you want to make changes to the Flex properties and re-bake the Point Cache, click the Enable Modifiers Below button before clicking Record. Remember to then disable the Flex modifier before attempting to play the animation or playback will still be slow.

Next up: using MAXScript to add buoyancy on a floating object while using Flex to simulate water.

Related Posts: