Liquid Simulation

Tags

Liquid Simulation

Flex - Part 2

Liquid Simulation

In this tutorial we will be looking at the use of the all wonderful flex modifier, which can help you add that elusive and oh so important principle, Secondary Motion to your animations.

As we know, secondary animation gives extra life to animation whether they are characters or simple objects effected by forces like gravity. Actions deserve reactions and we are going to allow them to happen using some more advanced methods of a rather simple modifier called Flex. In this tutorial, Part 2 ... we are going to simulate the reaction liquids have when a solid is dropped through them.

To start this tutorial open up a new 3DS Max scene and create a plane in your top viewport. Once you have made your plane go to the modify tab and give it the settings below.

plane1pers jpg

On the modify tab,

Give your plane a length and width of 150 to give it room to move.

Put 20 segments in length and width. We can always add more later for a smoother animation, but for now this will do the trick.

Grab your move tool and then down in the XYZ coordinates make sure that in all the fields it is marked 0.0.

Then create a sphere above the plane. Give it a radius of 10.

sphereandplane jpg

Grab your move tool and select the sphere, then go down to the coordinates for the XYZ location of the sphere and make sure to type in 0.0 for X and Y, and then +80 for the Z location. This will move our sphere directly to the middle of our plane only starting out 80 points above the ground level where our water will be.

Next we need to animate our ball dropping through the plane which will represent our water.

We could use a physics simulator like Reactor, or in 3DSMax 2012 now MassFX to make it fall using realistic gravity simulations, but for this tutorial a simple keyframe animation should do fine.

Turn on your Auto Key (N).

Go to frame 20, and with your move tool selected move the sphere down to below the surface of the water. Underneath the plane.

Then turn off your Auto Key (N).

Scrubbing back and forth should show your ball moving from top to bottom through your plane. It is moving a bit stiff so here is where we can apply our tangents to make the ball fall faster toward the end of its journey and slower at the beginning.

Find the first keyframe you created at frame 0 on the timeline and right click on it, then select "Sphere01: Z Position" from the menu.

The keyframe's tangent dialogue box will open.

As this is the first keyframe in the animation we don't need to worry about the "In" tangent at all as it is irrelevant.

We do however want to make the Out: tangent set to the Slow tangent.

When the curve matches the one above in the Out: setting. close the dialogue box. This will make our sphere start falling slow and speed up as it travels towards the next keyframe.

Then do the same thing for our second keyframe at frame 20. Right click, and select Z Position for the sphere.

This time we are going to alter the In: tangent. Set the In: to the fast Tangent.

This tangent lets our ball speed up as it gets closer to the second keyframe. It will give our animation the proper slow in / slow out that you might see in reality.

When finished close the tangent dialogue box and scrub back and forth along your timeline to see the difference we have made in how the ball falls.

Good, now we need to add a Deflector to the scene. Our flex modifier will react to the deflector that we assign to the sphere. Giving us our action/reaction of the ball falling through water, and the resulting ripple effects.

To find your deflectors go to the Create Tab, and over to Space Warps. In the drop down menu, select Deflectors.

Flex works well with all of the default deflectors in max, but we want to use one that we can assign an object to. Select UDeflector from the menu. The last button on the right, and drag out the deflector icon in your scene, it does not matter where.

<----->

Once you have created a UDeflector, select it and go to your Modify tab to adjust the settings.

Click on the large Pick Object button to turn it on, and then click on your sphere in the scene. It should add Sphere01 to the Item: in the Basic Parameters rollout.

<-----

That's all we need to do to the deflector.

Now select your Plane from the scene and on the Modify tab, select Flex from the modifier drop down list.

The flex is what is going to make our plane react like water when the ball falls through the surface.

All we have to do is modify a few settings in the Flex Modifier.

First change the Strength and Sway to 0.1. The lower these values are the more our plane will react like a liquid.

Make sure your Stretch and Stiffness levels are set like the image on the left.

Without enough stiffness our water will fall away from where it is currently located. Making the stiffness number 7, will make it sit firmly in place, and still allow it to react like a liquid.

Next, scroll down the settings rollouts until you see the Forces and Deflectors rollout.

In the deflectors section, click the add button to turn it on, and then click on the UDeflector icon we made in our scene to add it to the list in our flex modifiers like above.

Good, only one last thing to change before we can test our animation.

Go back up all the way to the modifier stack on the Modify tab, and next to the Flex modifier you will see a + sign in a small black box. Click to open the Flex modifiers sub object selections.

Then select Weights & Springs from the list.

You will notice what looks like a rainbow colored soft selection appear on the plane where all the vertices are. This is where the weights are assigned for the reaction of your water.

You should notice that with a soft selection default like this that the vertices will move less and less as we reach the outside edge of plane. This means that the surface of our water won't be effected until the ripple created by our falling ball reaches the outside of the water. We could leave it this way, but water tends to react a bit different than this.

So select all of the vertices on the plane while in the sub object of Weights & Springs.

Then scroll down the modifier settings until you find the Weights and Painting rollout.

Check the box marked Absolute Weight, and then make

the Vertex Weight: 0.1 and hit enter. This makes all of the vertices the same weight and will allow for more fluid movements throughout the plane.

Good, all the vertices should appear blue now instead of rainbowed.You can unselect the Weights & Springs by clicking the word Flex in the modifier stack now.

Only thing left to do is to make our plane a Simple Soft Body. Find the Simple Soft Bodies rollout in the Flex Modifier settings and notice the large "Create Simple Soft Body" button. Click it.

Scrub back and forth along your timeline to see the resulting reactions.

We can now add a turbosmooth modifier on top of our Flex modifier to smooth out the jagged edges of our lower poly plane.

You can adjust the number of segments on the plane itself as well, but you may need to recalculate settings a bit and redo the "Create Simple Soft Body" button.

All our water needs now is a Lights, a water texture and perhaps a box to contain the edges of your water pool and you are set!

Flex for water! Especially since reactor is no longer with us in 3DS Max 2012, but more on that at a later date!

water jpg

Sample Animation:

1