You are on page 1of 31

Cloth Simulation WorkShop

Presented By Joe Russo


7th Quarter Animation Student

February 1st, 2007


Introduction
Cloth simulation is one of the coolest parts of CG. However, to achieve realistic
results is no easy task. A lot of trial and error, proper settings, and extreme patience are
required. If these technicalities are mastered, cloth can be manipulated correctly.

The goal of this workshop is not to produce an award winning animation; but
rather, to provide information on how to correctly set-up cloth so that once you approach
a personal animation project you know which settings do what.

For personal and simplicity reasons, 3D Studio Max 8 will be the software used.
However, the basic concept of simulation is relative to any 3D application.

Note: A basic knowledge of 3D Studio Max is required; this is an intermediate


level workshop.

Set-Up and Warnings


This workshop contains a pre-animated character that will be the target for the
simulation. We will then use spline shapes to create cloth objects. This sets up a practical
situation for the simulation, rather than some simple cloth sheet deforming over a sphere.
This shows us the difficulties in simulating cloth on a character and therefore allows us to
understand settings more importantly.

Open the file Scene_Start.max in 3D Studio Max 8.

Unfortunate accidents that have happened during this project, and how to fix them:

Note: It has come to my attention that some of the plugins for max have been disabled. The two that we
need for this workshop are Cloth and Garment Maker. To enable these in 3D Studio Max 8 go to:
CustomizeÆPlug-in ManagerÆRight-Click in managerÆbrowse for the plugins folder in the 3D Studio
Max 8 folder and find the Cloth and Garment maker plugins.

So with that…Let’s Begin!


Section One: Setting up the Flap/Skirt

Step OneÆ Select the rectangle splines, and then go into vertex sub-object mod.
Select all the vertexes and click break. This will be explained later.
Step TwoÆ Under the Modify Panel, add the Garment Maker Modifier to the splines’
stack.
Step ThreeÆ Under the Main Parameters rollout of the Garment Maker in the modify
tab, select figure and choose the Hallow Knight’s hips.
Step FourÆ With the hips as the reference, choose mark points on figure and click the
hips several times.
Step FiveÆ Under the Garment Maker Modifier, select panels. Choose a panel from
the two rectangles then click front center, and back center with the other panel. Line
them up appropriately.
Step SixÆ With the two flap panels lined up, under Garment Maker choose seams.
Pick the two parallel edges from the rectangles and choose create seam. WARNING: Do
not undo a seam action, you must select delete seams. Max 8 contains a glitch that
makes your spline objects disappear if undo is pressed.

We are now ready to simulate the cloth around his hips and thighs.
Section Two: Simulating the Flap/Skirt.

Step OneÆ In the modify panel add a cloth modifier to the splines’ modifier stack.
Note that we are not using reactors’ cloth modifier but 3D Studio Max 8’s native cloth
modifier.
Step TwoÆ Under the Object rollout of the Cloth modifier, click object properties.
Step ThreeÆ Click add objects on the left column. Highlight and add
Hallow_Knight_Hips, Upper_Leg_L and Upper_Leg_R.
Step FourÆ Important. Highlight Flaps and switch it from inactive to cloth.
Highlight the hips and legs and switch them to a collision object. Press OK. The default
settings will be fine.
Step FiveÆ Click simulate local (damped) until the cloth takes the appropriate shape
and the sewing springs are fairly spaced apart. We will fix this in the next step.
Step SixÆ Uncheck Use Sewing Springs under simulation Parameters. Press simulate
local again. This will allow us to close the seam and make the shape truer to the form.
Step SevenÆ Before we simulate it to the animation, we need to constrain vertexes to
the hips so it acts more like a skirt. Under the cloth modifier, highlight group. Select the
top vertexes of the skirt and click Make Group. Name it whatever works for you.
Step EightÆ Select Surface and choose the knights’ hips. This will constrain just
these vertexes to the mesh, but allow the rest to free fall. A more in-depth explanation of
group types is provided at the end of this document.
Step NineÆ The next step before we simulate is very important. Before we simulate,
we need to calculate global simulation parameters based on unit measures of our objects.
Of course, for the sake of this workshop, I have pre-calculated values for this. Under
simulation parameters change cm/unit to 4.45, subsample to either 2, 3, or 4, and turn on
self collision. Like previously stated, these settings are described at the end of this
document.
Step TenÆ Press simulate, and the cloth will deform to the collision meshes.
Hopefully your results turned out decent so that you have a base level of control to work
with. They will most likely never be accurate at first. This is where trial and error comes
into play in messing with settings.

You have successfully set up a skirt/flap for the knight. This process can be translated
into more advanced cloth set up, such as pants, shirts, bands, etc.

Next up is the Cape.


Section Three: Setting up and simulating the cape.

Note: Click the layer manager button on the top toolbar and unhide the cape
layer.

Step OneÆ Apply Garment maker and the Cloth modifiers to the stack of the cape.
Because this is only made of one piece, we do not need to worry about figure set up and
seams.
Step TwoÆ Select object properties. Switch the cape to a cloth object then click add
objects. Select all of the objects on the scene and add them, switching them to a collision
object. Even though the flap is a cloth object, we want the cape to recognize it as a
collision object.
Step ThreeÆ Highlight the cape and set the values under the cloth properties
according to the following image. Again, it would take trial and error to figure out these
values. There is however, a selection of presets to use for a base start.
Step FourÆ We’ll need to constrain the top vertexes of the cape to the Knight mesh so
that the cloth stays attached while it simulates. Like in the previous section, make a
group and choose a surface attachment to the knight’s armor.
Step FiveÆ Before we simulate the cape to the animation, let’s first get the cape into
its correct shape. Click Simulate local and let the cape fall into place. This simulation
may take a few minutes.
Step SixÆ Since we have the previous simulation parameters, we are ready to
simulate. This will probably take 5 minutes for just 200 frames so grab a snack. Again,
the results will not be desirable at first, so switch settings and understanding how they
affect the scene is an absolute must for realistic cloth.

Conclusion:

Hopefully you have gained a basic understanding of simulating cloth in 3D applications.


Understand though that trial error cannot be stressed enough in getting this to work.
Getting frustrated is easy, but if you study the technical aspects of cloth and understand
it, it turns into a lot of fun.

Last minute tip: If you’d like to make the cloth to have thickness and smoothness, add a
shell modifier followed by a HSDS modifier, not turbosmooth, to subdivided the
polygons.
Term reference (taken from MAX 8’s help file).

U Bend/V Bend—Resistance to bending. The higher this value is set, the less the fabric
will be able to bend. A cotton fabric might bend more easily than leather, so a value of
15.0 for both U and V Bend might be good for cotton, while 50.0 would work well for
leather.

By default, the U Bend and V Bend parameters are locked together so that changing one
sets the other to the same value. You can set different values for the two only when
Anisotropic is off. It is recommended to do this only for Garment Maker objects.

U B-Curve/V B-Curve—Resistance to bending as the fabric folds. The default value of


0 sets the bend resistance to be constant. A setting of 1 makes the fabric very resistant to
bending as the angle between triangles approaches 180 degrees. You never want two
adjacent triangles to pass through each other, so you can increase this value to prevent
this from happening.

By default, the U B-Curve and V B-Curve parameters are locked together so that
changing one sets the other to the same value. You can set different values for the two
only when Anisotropic is off. It is recommended to do this only for Garment Maker
objects.

U Stretch/V Stretch—Resistance to stretching. The default value of 50.0 is a reasonable


value for most types of cloth. A Larger value will be stiffer, while a smaller one will be
stretchy like rubber.

By default, the U Stretch and V Stretch parameters are locked together so that changing
one sets the other to the same value. You can set different values for the two only when
Anisotropic is off. It is recommended to do this only for Garment Maker objects.

Shear—Resistance to shearing. Higher values result in stiffer cloth fabrics. Shear defines
how much the individual triangles can deform. If you were to lay the edges of the triangle
out in a strait line this value would represent how long this line can stretch out to. With a
high value this length will only be the sum of the length of all of the sides at rest. A low
value will allow this length to be greater then that off all of its sides at rest. This length of
stretched sides is not on a one to one basis. One side of the polygon may stretch more
then another as long as the total shear value is not exceeded.

Density—The weight of the cloth per unit area (in gm/cm2). Higher values mean heavier
cloth like denim. Use smaller values for lighter cloth like silk.
Thickness—Defines the virtual thickness of a fabric for the purpose of detecting cloth-
to-cloth collisions. This value is irrelevant if cloth-to-cloth collisions are disabled. Larger
values keep the cloth separated by greater distances. Be careful not to use too large or
small values in this field. Very large values will interfere with the natural behavior of the
cloth. Very small values will cause the simulator to take too long to calculate. This
distance is measured in cm (centimeters) and should be smaller than the size of the
triangles that make up the cloth object. A setting of 0.0 will let Cloth automatically assign
a reasonable value for thickness.

Repulsion— The amount of force used to repel other cloth objects. This value is
irrelevant if cloth-to-cloth collisions are disabled. The simulator will apply a repulsion
force scaled by this value to keep the cloth from coming in contact with other cloth
objects. Increase this value if there are a lot of collisions between different parts of cloth,
or if the cloth is tending to interpenetrate.

Damping— The larger this value, is the more sluggishly the fabric will react. With a
lower value, the fabric will behave with more spring. Cloth with more damping will come
to rest sooner then cloth with less damping. High damping results in cloth that behaves as
though it is moving through oil. Excessive damping may also cause simulation
instabilities. A good value is 0.01 (note: the default is 0.1, but in practice, it seems that
this value is too high).

Air Res.— Resistance to Air. This value will determine how much the air will effect the
cloth. A higher amount of air resistance would be useful for a tightly woven fabric, while
a lower amount would be suitable for a loose-knit garment.

Dyn. Fric.— Dynamic friction between the cloth and solid objects. A larger value will
add more friction and cause the fabric to slide less across an object. A lower value will
allow the fabric to slip off an object very easily, similarly to how silk would react.

Static Fric.— Static friction between the cloth and solid objects. When the cloth is in
stationary position, this value will control its ability stay where it is, or slip away.

Self Fric.— Friction between the cloth and itself. This is similar to dynamic and static
friction, but applies to cloth-to-cloth or self-collisions. A larger value will cause more
friction between the cloth and itself.

U Scale—Controls how much to shrink or expand the cloth along the U direction (as
defined by Garment Maker. For non-Garment Maker meshes, this applies a uniform
scaling to the cloth along both axes, and the V Scale parameter is ignored). A value of
less than 1 will shrink the fabric at simulation time, while a value of more than 1 will
stretch it.

V Scale—Controls how much to shrink or expand the cloth along the V direction (as
defined by Garment Maker). A value of less than 1 will shrink the fabric at simulation
time, while a value of more than 1 will stretch it.
Seam Force—Not presently used and only kept for backward compatibility with older
versions of the former product called Stitch. This was a global seam strength, but seam
strength is now defined on a seam-by-seam basis at the Seams sub-object level.

Plasticity—The tendency of the cloth to keep its current deformation (that is, the bend
angles).

This is different from Keep Shape, which determines the extent to which the cloth tends
to keep its original deformation (or the one defined by the Target State). If you set
Plasticity to 100.0, the cloth will not attempt to change the angles between triangles. If
you want stiffer cloth, but you don't want the cloth to "balloon" up, increase the Plasticity
value.

Depth—Collision depth. If a portion of cloth reaches this depth inside a collision object,
then the simulation will no longer try to push the cloth out of the mesh. This value is
measured in 3ds Max units.

Offset—The amount of distance kept between the cloth and the collision object. A very
low value can cause the collision mesh to protrude out from under the cloth. A very high
value will cause the fabric to look as if it is floating on top of the collision object.

Use Cloth Depth/Offset—Uses the Depth and Offset values set for the panel (see
preceding). When on, the cloth object ignores the collision object Depth and Offset
values.

Based on—Lists the preset that the panel properties are based on. When you modify
parameters and save a preset, Cloth uses the name of the last preset you loaded as the
“Based on” name.

Anisotropic—When on, you can set different U and V values for the Bend, B-Curve, and
Stretch parameters. The U and V directions are defined by Garment Maker and do not
apply to non-Garment Maker meshes, for which setting different U/V values might result
in unexpected behavior.

Use Edge Springs—This is an alternative method for calculating stretch. When this
option is on, stretch force is based on springs along triangle edges. (Whereas normally the
stretch and shear forces are calculated in a more sophisticated manner to more accurately
reflect the underlying physics).

Use Solid Friction—Uses the friction of the collision object to determine friction. Values
for collision can be assigned either to the cloth or the collision objects. This enables you
to set different friction values for each collision object

Keep Shape—When on, preserves the shape of the mesh. In normal operation, when
Cloth creates a simulation, it tries to "flatten out" the cloth.
The numeric Keep Shape value modulates the target bend angles to a value between 0.0
and the angles defined by the target state. A negative value inverts the angles. Range=-
100.0 to 100.0. Default=100.0.

Make Group—Makes a group out of selected vertices. Select the vertices to include in
the group, and then click this button. Name the group, and it will then show up in the list
below for you assign to an object.

Delete Group—Deletes the group highlighted in the list.

Detach—Removes any constraint assigned to the group and sets it back to being
unassigned (i.e., without any constraint). Any unique properties assigned to this group
will remain in effect.

Initialize—Constraints that involve attaching the vertices to another object (Node,


SimNode, Surface and Cloth constraints) contain information regarding the relative
positions of the group vertices to the other object. This information is created upon the
creation of the constraint. To regenerate this information, click this button.

Change Group—Lets you modify the vertex selection in the group. To use, follow this
procedure:

1. Choose the group in the list.


2. Change the selection of vertices.
3. Click Change Group.

Rename—Renames the highlighted group.

Node—Constrains the highlighted group to the transforms of an object or node in the


scene. To use, click Node, and then select the node for constraining. The node cannot be
an object in the simulation; for that purpose, use the SimNode constraint.

Note: Node and SimNode simply constrain the group to an object's transforms, not to the
object itself. They need not be near each other. When the cloth and the constraining
object should be in close proximity, such as with clothing on a character mesh, use the
Surface constraint instead (see following).

Surface—Attaches the selected group to the surface of a collision object in the scene. To
use, click Surface, and then select the node for attaching.

Tip: This constraint is best suited for when the cloth and the constraining object should
be in close proximity, such as with clothing on a character mesh.
Cloth—Attaches the selected group of cloth vertices to another cloth object.

Preserve—This group type preserves the motion from below the Cloth modifier in the
modifier stack. For example, you might have a dress that you've skinned to a skeleton.
You want the upper portion of the dress to be unaffected by the Cloth simulation (that is,
to retain its deformation defined by the skinning), and the lower part to be simulated. In
this case, you'd make a Preserve constraint from the upper vertices.

Drag—This group type locks the vertices in place or adds a damping force to selected
group. When Group Parameters rollout > Soft is off, you can use this constraint for
“nailing” vertices in place so that they do not move at all. When Soft is on, the vertices
will have a drag force applied where the amount of drag is controlled by the Strength and
Damping values, also on the Group Properties rollout.

SimNode—This option works the same as the Node option, except the node must be part
of the Cloth simulation.

Group—Attaches one group to another. This is recommended only for single-vertex


groups. (that is, groups that contain only one vertex). With this, you can make one cloth
vertex stick to another cloth vertex. Select one group, click this button to open the Pick
Group dialog , and then choose another group.

NoCollide—Causes collisions between the currently selected group and another group to
be ignored. When you click this button, you're prompted to choose another group. You
could use this option to prevent the simulator from processing collisions between cloth
and the body under an arm or between the legs.

Forcefield—Allows you to link a group to a space warp and have the space warp affect
the vertices.

Sticky Surf—The group sticks to a surface only after it has collided with that surface.
Solid Coll must be enabled for this constraint to work.

Sticky Cloth—The group sticks to a surface only after it has collided with that surface.
Self Coll must be enabled for this constraint to work.

[group list]—Shows all current groups. The number of vertices associated with the
highlighted group is shown below the list. To assign, copy, paste, delete or alter a created
group, first highlight the group name in the list.

Copy—Copies a named selection set to the copy buffer.

Paste—Pastes the named selection set from copy buffer.

cm/unit—Determines how many centimeters there are per 3ds Max unit. Size and scale
are important when doing cloth simulation because a 10-foot curtain behaves much
differently from a one-foot square handkerchief, even if they are made of the same fabric.
The default is set to 2.54 centimeters for each 3ds Max unit. This makes each 3ds Max
unit equal to about an inch. You may set this to 1 which will make each 3ds Max unit
equal to a centimeter, or 30 which will equal a foot for each 3ds Max unit.

Earth—Click this button to set the Gravity value to that of planet Earth.

Gravity—When on, the Gravity value (see following) affects cloth objects in the
simulation.

[Gravity value]—The force of gravity in cm/sec2. A negative value applies gravitational


force downward. A positive value (i.e., no sign) means gravity will act to move cloth
objects upward. The default value is set to be the same as Earth's gravity: -980.0 cm/sec2.

Step—The maximum size of the time step the simulator takes.

This value is measured in seconds. The value must be less than the length of one frame
(less than 0.033333 for 30 fps animation). A value of 0.02 is generally the largest value
you want to use. Reducing this value causes the simulator to take longer to calculate, but
will in general give better results. The simulator will automatically reduce its time steps
as needed, but this is the maximum value that it will try. This value works in conjunction
with the Subsample parameter: The actual maximum value=Step value divided by
Subsampl value.

Subsample—The number of times per frame that the software samples the position of
solid objects. Default=1.

At the default value, Cloth samples the solid objects in the simulation once every frame.
Increasing this value should help when objects are moving or rotating quickly, but be
aware that the higher you set the value, the slower the simulation will be.

Start Frame—The frame at which the simulation starts. If you change this value after
the simulation has been performed, the cache will be moved to this frame. Default=0.

End Frame—When on, determines the frame at which the simulation will stop.
Default=100.

Self Collision—When on, detects cloth-to-cloth collisions. Leaving this off will speed up
the simulator, but will allow cloth objects to interpenetrate.

The numeric setting specifies the extent to which Cloth tends to avoid self-colliding cloth
objects, at the cost of simulation time. Range=0 to 10. Default=1.

This is a maximum limit. If Cloth needs fewer calculations to resolve all collisions, it will
use fewer. In most cases, a value greater than 1 isn't necessary.
Solid Collision—When on, the simulator takes into account cloth-to-solid object
collisions. This is almost always left on.

Use Sewing Springs—When on, uses the sewing springs created with Garment Maker to
pull the fabric together.

This works only with objects that have been made with Garment Maker. Turn this option
off once the garment has been pulled together. When off, Cloth will identify vertices that
are sewn together and will always keep them coincident. When on, there is always a
chance for the vertices to come apart if the sewing springs are not strong enough
(actually, there will always be some slight gap between the vertices in this case).

Show Sewing Springs—Toggles the visual representation of the sewing springs in the
viewports. These do not render.

Sim on Render—When on, triggers the simulation at render time. Use this for generating
a simulation with a network computer, which lets you continue to work on other aspects
of your scene with your own computer. See a procedure here.

After the render is completed, Cloth writes a cache for each cloth object. You can specify
this cache file on the Selected Object rollout (which is available only when a single
object is selected). If you do not specify a name, the software creates one.

The numeric value indicates the priority of the simulation; the simulations are run in
ascending order. For modifiers with the same priority, the order is undefined.

Note: Each object has its own cache file, which is temporarily created when the MAX file
is opened. On saving the file, the cache is incorporated into the MAX file. When Sim On
Render is on, the cache file specified is created and written to, but is not read from as you
change the time slider. The cache file must be loaded into the internal cache file before
you can see it.

Advanced Pinching—When on, Cloth tests for cloth pinched between two parts of the
same collision object.

This option helps with cloth colliding with small features of the collision objects, such as
fingers. Currently there is a significant performance hit for high-resolution collision
objects.

Joe Russo 2007

You might also like