by Vlado
For this set of tutorials you'll need SimCloth version 2.01. If you don't have it, you can download it at http://www.chaosgroup.com/simcloth.html. It's a good idea to read through the .rtf file that comes with simcloth, as it will give you some basic idea about the plug-in. These tutorials also include some tips and info about SimCloth that are not included in the .rtf, but are useful to know. They are usually marked with Note before them.
This tutorial is here not because it is very interesting, but because it seems that falling ribbons are kind of classical for cloth simulation systems :-)
We'll have
two objects in the scene - a ground plane and the ribbon itself. In the top
viewport create a plane about 400 x 400 units, 1 x 1 segments. Apply a SimClothMod
modifier to the plane. In the SimCloth parameters roll-up, in the Type
group select Deflector. This means that SimCloth will not attempt
to animate the ground plane, but will try to stop other objects from passing
through it.
In the front viewport create a plane about 400 x 20 units, and 80x 4 segments. This will be our ribbon. Leave about 75 units between the lower end of the ribbon and the ground plane. Apply a SimCloth modifier to the ribbon and set its Type to Cloth. Go to the Deflection group of params and check Self-deflect - we don't want the ribbon to pass through itself. Also set Bound. box divs to 30 - the plane has many polygons along its length, and the more divisions of its bounding box will speed the calculations a little bit.
At this point it's good to apply a 2-sided material to the ribbon so that both its sides are visible, and uncheck Backface cull in the properties dialog for the plane, so that it can be selected from the back side.
We are ready to run the cloth simulation (it won't be ok from the first try, don't be so fast :-). Press the Start calculation button at the top of the SimCloth roll-up. If you don't want to wait for the whole range of frames (0-100 by default) to be computed, press and hold down the Esc key until SimCloth stops calculating. When you go through the animation, you'll notice that the cloth falls too slowly to look real and it wrinkles too much like paper. Also to me the ribbon look a little too "flowy".
The first problem is solved by increasing Gravity. Set this to 1.0 and run the simulation again. Keep a close look at the statistics box (right below the progress bar, which in turn is right below the Start calculation button) - you'll see that very soon it will say Self-intersection detected and this will stay until the end of the calculation, with 4 subsambles per frame. This is because the ribbon falls down really fast. For this reason we'll set Air resistance to 0.02 - this will slow the cloth down a bit. Also set Min subdivs in the Sampling group to 2 and Max subdivs to 4 - this will make SimCloth do at least two samples per frame and jump to eight samples if necessary. Note: more samples per frame have better deflecting ability; if SimCloth needs to change the rate of samples/frame too often, this might result in flickering. The only way to avoid this is to increase Min subdivs.
Now if you calculate the scene, you'll see that SimCloth manages to recover from all detected intersections. However, the ribbon still wrinkles too much when it first touches the ground, and it's still runny.
The wrinkling is avoided by increasing Bond range - carefully, since too high values might cause "integrity loss" - when where are more bonds, the force that acts on each vertex is greater, and the result might be "explosion" - vertices flying chaotically in all directions. SimCloth tries to detect such cases and will put up a message box saying "Object integrity loss". To avoid the integrity loss, reduce Tightness and/or Keep speed. Note: you may get false integrity loss messages if the size of two objects in a simulation differs greatly (about 500-1000 times). The only way to deal with this is to make the larger object smaller (by chopping parts of it or something). This is a limitation of SimCloth that I've been a little lazy to correct :-]
So back to our ribbon, set Bond range to 1.1. The result will be smoother curves when the ribbon wrinkles, and the cloth will look a little stiffer on the whole.
One final thing, though it is not really necessary - I like the simulation as it is at this point - but it may be useful. If you increase the Particle mass of the ribbon (to, say, 10.0), this will increase the friction between it and the plane a little bit (and when the cloth falls on itself too), and the cloth will tend to stay piled in one place.
After completing the calculations, you can add a MeshSmooth modifier on top of SimCloth to get a smoother surface. Note: if you decide to recompute the scene, you should delete or inactivate this MeshSmooth modifier. Generally, when calculating simulations, leave the SimCloth modifier to be the last active modifier on the stack. If you don't do this, SimCloth will get very confused.
The final
result should look like this picture (add materials and lights to taste :-)
The finished .max file (without the animation to save space, you'll need to run the simulation) is Scenes/ribbon.max relative to the directory with this file.
This scene uses the previous one as a starter. We'll just alter it to get the ribbon float in the air a bit and then settle down.
Open Scenes/ribbon.max
and save it under a new name. Rotate the ribbon until it is horizontally flat
above the ground plane, but don't move it. Enlarge the ground plane to about
800 x 800 units so that we have more space to fly the ribbon around. Then create
an upward wind space warp.
For this scene we want the ribbon to fall down slowly, so we'll set Gravity to 0.2 and Air resistance to 0.04. Also, since there won't be many deflections, we can set Min. subdivs to 1 - this will speed up our simulation.
Next, we've got to tell SimCloth that we want the wind space warp to influence the ribbon. Select the ribbon, and press the Pick warp button in the SimCloth params roll-up. Then click on the wind space warp. Its name appears in the list box above the Pick warp button. If you calculate the simulation now, you won't notice any trace of the wind. This is because its strength is too small for SimCloth. Select the wind and set its Strength to 100.0. To make things more interesting, we'll add some turbulence too - set Turbulence to 1500.0, Frequency to 0.001 and Scale to 0.01 (it did take me some time to find these numbers). You might as well extend the time segment to frame #150, since the cloth fill fall very slowly. Also set End frame in the SimCloth params to 150. We are now ready to run the simulation - select the ribbon and press Start calculation. That's it!
The result
should be something similar; the scene is Scenes/ribbon1.max
This is a very simple scene too, but I'll use it to show how to "scale" SimCloth for objects of larger or smaller scale than the normal.
We'll just have a cylinder which will represent the table, and a plane to represent the table cloth.
Create
a cylinder with Height set to 700.0 units and Radius of 6000.0
units, set Height segments to 1. Create a plane 16000 x 16000 units,
and 40 x 40 segments. Move the plane a little above the cylinder. Uncheck Backface
cull in the properties dialog for the plane, and assign a 2-sided material
to it.
Add a SimCloth modifier to the cylinder and set its Type to Deflector, add another SimCloth modifier to the plane, and set the Type to Cloth.
First of all we'll do some general params - the cloth plane has many segements, so we'll set Bound. box divs to 30 to speed computations up a bit. To save some more time, we'll also leave Self-deflect unchecked - there hardly will be any self-deflection in this case. In order to get smooth wrinkles set Bond range to 1.02, and to keep the cloth from stretching too much set Num. steps to 100.
To scale SimCloth to the size of out objects, we'll need to change two params - Gravity and Deflect distance. As the .rtf file that comes with SimCloth says, SimCloth tries to keep objects Deflect distance times Rel. pos. units. As a general rule this distance should be roughly about the size of the polygons in the cloth object, unless you're sure there won't be many sharp wrinkles. Also it's good to keep Rel. pos. below or equal to 0.5. A third thing to keep in mind is that it's best to keep Deflect distance the same for all interacting objects in the simulation. In our case we'll set Deflect distance to 200.0 for both the cylinder and the plane, and leave Rel. pos. to its default value.
That's about it. One final touch - set Air resistance to 0.05 to get the cloth settle gently on the table.
The result
should be something similar. The ready-for-computing scene file is in Scenes/tableCloth.max
<To be continued....>