Cloth simulation

Материал из Blender3D.

Перейти к: навигация, поиск
Cloth example
Cloth example
Cloth on carved wooden men (made by motorsep)
Cloth on carved wooden men (made by motorsep)
Cloth example
Cloth example
Cloth example
Cloth example



Cloth Simulation

Cloth simulation is one of the hardest aspects of CG, because it is a deceptively simple real-world item that is taken for granted, yet actually has very complex internal and environmental interactions. After years of development, Blender has a very robust cloth simulator that is used to make clothing, flags, banners, and so on. Cloth interacts with and is affected by other moving objects, the wind and other forces, as well as a general aerodynamic model, all of which is under your control.


Mode: Object Mode

Panel: Editing context&arr;Modifiers panel

Hotkey: F7 to get to Object context; repeat to change sub-context.

A piece of cloth is any mesh, open or enclosed, that has been designated as cloth. The Cloth panels are located in the Physics subcontext and consist of three panels of options. Cloth is either an open or closed mesh and is mass-less, in that all cloth is assumed to have the same density, or mass, per square unit.

Cloth is commonly modeled as a mesh grid primitive, or a cube, but can also be, for example, a teddy bear. However, Blender's Softbody system provides better simulation of closed meshes; Cloth is a specialized simulation of fabrics.

Cloth is a modifier in the object's modifier stack, so it can interact with other modifiers, such as Armature and Smooth. In these cases, the ultimate shape of the mesh is computed in accordance with the order of the modifier stack. For example, you should smooth the cloth AFTER the modifier computes the shape of the cloth.

You can Apply the cloth modifier to freeze, or lock in, the shape of the mesh at that frame, which removes the modifier. For example, you can drape a flat cloth over a table, let the simulation run, and then apply the modifier. In this sense, you are using the simulator to save yourself a lot of modeling time.

Results of the simulation are saved in a cache, so that the shape of the mesh, once calculated for a frame in an animation, does not have to be recomputed again. If changes to the simulation are made, the user has full control over clearing the cache and re-running the simulation. Running the simulation for the first time is fully automatic and no baking or separate step interrupts the workflow.

Computation of the shape of the cloth at every frame is automatic and done in the background; thus you can continue working while the simulation is computed. However it is CPU-intensive and depending on the power of your PC and the complexity of the simulation, the amount of CPU needed to compute the mesh varies as does the lag you might notice.

Don't jump ahead: If you set up a cloth simulation but Blender has not computed the shapes for the duration of the simulation, and if you jump ahead a lot of frames forward in your animation, the cloth simulator may not be able to compute or show you an accurate mesh shape for that frame, if it has not previously computed the shape for the previous frame(s).


A general process for working with cloth is to:

  1. Model the cloth object as a general starting shape
  2. Model other deflection objects that will interact with the cloth. Ensure the Deflection modifier is last on the modifier stack, after any other mesh deforming modifiers.
  3. Light the cloth and assign materials and textures, UV-unwrapping if desired.
  4. If desired, give the object particles, such as steam coming off the surface
  5. Run the simulation and adjust Options to obtain satisfactory results. The timeline window's VCR controls are great for this step.
  6. Optionally age the the mesh to some point in the simulation to obtain a new default starting shape
  7. Make minor edits to the mesh on a frame-by-frame basis to correct minor tears

Cloth Panel Options

Вкладка Cloth
Вкладка Cloth
Вкладка Cloth collisions
Вкладка Cloth collisions
Вкладка Advanced cloth functions
Вкладка Advanced cloth functions

Cloth is controlled by the three panels shown above. Each of the options (buttons and controls) on those three panels is fully documented in the Reference manual. This section discusses how to use those options to get the effect you want.

Cloth Definition

First, enable Cloth. Set up for the kind of cloth you are simulating. You can choose one of the presets to have a starting point.

As you can see, the heavier the fabric, the more stiff it is and the less it stretches and is affected by the air.

Next, position and pin the cloth in the desired position. Pinning is described below. Note that if you move the cloth object after you have already run some simulations, you must unprotect and clear the cache; otherwise, Blender will use the position of the current/cached mesh's verticies when trying to represent where they are. Editing the shape of the mesh, after simulation, is also discussed below. You may disable the cloth and edit the mesh as a normal mesh editing process. --this is jumping ahead and not clear and not true at this point. --Roger 18:42, 27 April 2008 (UTC) Finally, use the timeline Play button, or press Alt A in the 3D View to run the simulation. Your cloth will fall and interact with Deflection objects as it would in the real world. --this is jumping ahead and not clear and not true at this point. --Roger 18:42, 27 April 2008 (UTC)

Using Simulation to Shape/Sculpt a Mesh

You can Apply the Cloth Modifer at any point to freeze the mesh in position at that frame. You can then re-enable cloth, setting the start and end frames from which to run the simulation forward.

Another example of aging is a flag. Define the flag as a simple grid shape and pin the edge against the flagpole. Simulate for 50 frames or so, and the flag will drop to its "rest" position. Apply the Cloth modifier. If you want the flag to flap or otherwise move in the scene, re-enable it for the framerange when it is in camera view.


In most cases, a piece of cloth does not just hang there in 3D space, it collides with other objects in the environment. To ensure proper simulation,there are several items that have to be set up and working together:

  1. The Cloth object must be told to participate in Collisions
  2. Optionally (but recommended) tell the cloth to collide with itself
  3. Other objects must be visible to the Cloth object via shared layers
  4. The other objects must be mesh objects
  5. The other objects may move or be themselves deformed by other objects (like an armature or shape key).
  6. The other mesh objects must be told to deflect the cloth object
  7. The blend file must be saved in a directory so that simulation results can be saved.
  8. You then Bake the simulation. The simulator computes the shape of the cloth for a frame range.
  9. You can then edit the simulation results, or make adjustments to the cloth mesh, at specific frames.
  10. You can make adjustments to the environment or deforming objects, and then re-run the cloth simulation from the current frame forward.

Cloth Collision

Вкладка Cloth collisions
Вкладка Cloth collisions

Now you must tell the Cloth object that you want it to participate in collisions. For the cloth object, locate the Cloth Collision panel, shown to the right:

Enable Collisions

image:ЛКМ.png click this to tell the cloth object that it needs to move out of the way

Min Distance

As another object gets this close to it (in Blender Units), the simulation will start to push the cloth out of the way.

Collision Quality

A general setting for how fine and good a simulation you wish. Higher numbers take more time but ensure less tears and penetrations through the cloth.


A coefficient for how slippery the cloth is when it collides with the mesh object. For example, silk has a lower coefficient of friction than cotton.


Real cloth cannot permeate itself, so you normally want the cloth to self-collide. ,

Enable Selfcollisions

image:ЛКМ.png click this to tell the cloth object that it should not penetrate itself. This adds to simulation compute time, but provides more realistic results. A flag, viewed from a distance does not need this enabled, but a close-up of a cape or blouse on a character should have this enabled.

Min distance

If you encounter problems, you could also change the Min Dist value for the self-collisions. The best value is 0.75, for fast things you better take 1.0. The value 0.5 is quite risky (most likely many penetrations) but also gives some speedup.

Selfcoll Quality

For higher self-collision quality just increase the Selfcoll Quality and more selfcollision layers can be solved. Just keep in mind that you need to have at least the same Collision Quality value as the Selfcoll Quality value.

Regression blend file: Cloth selfcollisions

Shared Layers

For example, suppose you have two objects: a pair of Pants on layers 2 and 3, and your Character mesh on layers 1 and 2. You have enabled the Pants as cloth as described above. You must now make the Character 'visible' to the Cloth object, so that as your character bends its leg, it will push the cloth. This principle is the same for all simulations; simulations only interact with objects on a shared layer. In this example, both objects share layer 2.

To view/change an object's layers, RMB Image:Template-RMB.png click to select the object in object mode in the 3D view. M to bring up the Move Layers popup. This popup shows you all the layers that the object is on. To put the object on a single layer, LMB Image:Template-LMB.png click the layer button. To put the object on multiple layers, Shift LMB Image:Template-LMB.png the layer buttons. To remove an object from a selected layer, simply Shift LMB Image:Template-LMB.png the layer button again to toggle it.

Mesh Objects Collide

If your colliding object is not a mesh object, such as a NURBS surface, or text object, you must convert it to a mesh object. To do so, select the object in object mode, and in the 3D View header, select Object->convert Object type Alt C and select Mesh from the popup menu.

Cloth - Object collisions

Collision settings
Collision settings

The cloth object needs to be deflected by some other object. To deflect a cloth, the object must be enabled as an object that collides with the cloth object. To enable Cloth - Object collisions, you have to enable deflections on the collision object (not on the cloth object).

In the Buttons Window, Object Context, Physics subcontext buttons, locate the Collision panel shown to the right. It is also important to note that this collision panel is used to tell all simulations that this object is to participate in colliding/deflecting other objects on a shared layer (fluids, soft bodies, and cloth).

Mesh Object Modifier Stack

Collision stack
Collision stack

The object's shape deforms the cloth, so the cloth simulation must know the "true" shape of that mesh object at that frame. This true shape is the basis shape as modified by shape keys or armatures. Therefore, the Collision modifier must be after any of those. The image to the right shows the Modifiers panel for the Character mesh object (not the cloth object).

Bake Collision


After you have set up the deflection mesh for the frame range you intend to run the simulation (including animating that mesh via armatures), you can now tell the cloth simulation to compute (and avoid) collisions. Select the cloth object and in the Object Physics buttons, set the Start: and End: panels for the simulation frames you wish to compute, and click the Bake button.


the starting frame of the animation when you want the cloth to start responding


the end frame of the simulation. The cloth will remain "frozen" after End


Starts the simulation process.

You cannot change Start or End without clearing the bake simulation. When the simuulation has finished, you will notice you have the option to free the bake, edit the bake and re-bake.

Free Bake

Deletes the simulation, enabling you to make changes and then start over

Bake Editing

Enables you to protect the cache and prevent the simulation from recomputing the mesh shape. You can then edit the mesh shape manually.

Rebake From Current Frame

Enables you to re-compute the cloth simulation from the current frame to End:

Standard settings cloth collide with sphere
Standard settings cloth collide with sphere

There's a few things you'll probably notice right away. First, it will bake significantly slower than before, and it will probably clip through the box pretty bad as in the picture on the right.

Editing the cached simulation

The cache contains the shape of the mesh at each frame. You can edit the cached simulation, when you baked the simulation and pressed the Bake Editing button. Just go to the frame you want to fix and TAB into editmode. There you can move your vertices using all of Blender's mesh shaping tools. When you exit, the shape of the mesh will be recorded for that frame of the animation. If you want Blender to resume the simulation using the new shape forward, LMB Image:Template-LMB.png click Rebake from next Frame and play the animation. Blender will then pick up with that shape and resume the simulation.

Edit the mesh to correct minor tears and places where the colliding object has punctured the cloth

If you add, delete, extrude, or remove the vertices in the mesh, Blender will take the new mesh as the starting shape of the mesh back to the First Frame of the animation, replacing the original shape you started with, up to the frame you were on when you edited the mesh. Therefore, if you change the content of a mesh, when you Tab out of edit mode, you should unprotect and clear the cache From next frame so that Blender will make a consistent simulation.


If you encounter some problems with collision detection there are two ways to fix them:

  • The fastest solution would be to put up the 'Min Distance' setting under the Cloth Collisions panel. This will be the fastest way fix the clipping, however, it will be less accurate and won't look as good. Using this method tends to make it look like the cloth is resting on air, and gives it a very rounded look.
  • A second method is to increase the "Quality" (in the first panel). This results in smaler steps for the simulator and therefore to a higher propability that fast moving collisions get catched. You can also increase the "Collision quality" to perform more iterations to get collisions solved.
  • If none of the methods help, you can easily edit the cached/baked result in editmode afterwards.

My Cloth is torn by the deforming mesh - he "Hulks Out"

Increase the Structural Stiffness very high, like 1000


To start with cloth, the first thing you need, of course, is some fabric. So, lets delete the default cube and add a plane. I scaled mine up along the Y axis, but you don't have to do this. In order to get some good floppy and flexible fabric, you'll need to subdivide it several times. I did it 8 times for this example. So TAB into edit mode, and press WKEY and then 'Subdivide multi', and set it to 8. Now, we'll make this cloth by going to the Object buttons(F7), then the sub-section Physics buttons. Scroll down until you see the 'Cloth' panel, and press the Cloth button. Now, a lot of settings will appear, most of which we'll ignore now.

That's all you need to do to set your cloth up for animating, but if you hit Alt A, your lovely fabric will just drop very un-spectacularly. That's what we'll cover in the next two sections about pinning and colliding.

Pinning of cloth

Cloth in action
Cloth in action

The first thing you need when pinning cloth are Vertex Groups. There are several ways of doing this including using the Weight Paint tool to paint the areas you want to pin (see the Weight paint section of the manual).

Once you have a vertex group set, things are pretty straightforward, all you have to do is press the 'Pinning of cloth' button in the Cloth panel and select which vertex group you want to use, and the stiffness you want it at. You can leave the stiffness as it is, default value is fine.

Smoothing of Cloth

Now, if you followed this from the previous section, your cloth is probably looking a little blocky. In order to make it look nice and smooth like the picture you need to apply a Smooth and/or Subsurf modifier in the modifier panel under the Editing buttons(F9). Then, also under the editing buttons, find the Links and Materials panel (the same one you used for vertex groups) and press 'Set Smooth'.

Now, if you hit Alt A Things are starting to look pretty nice, don't you think?

Cloth on armature

Cloth deformed by armature and also respecting an additional collision object: Regression blend file

Using Cloth for Softbodies

Using cloth for softbodies
Using cloth for softbodies

Cloth can also be used to simulate softbodies. It's for sure not it's main purpose but it works nontheless. The example image uses standard "rubber" material, no fancy settings, just ctrl-a.

Blend file for the example image: Using Cloth for softbodies

Cloth with Wind

Flag with wind applied
Flag with wind applied

Regression blend file for Cloth with wind and selfcollisions (also the blend for the image above): Cloth flag with wind and selfcollisions


For more information, consult the developer's Main development page of Blender Cloth.

Личные инструменты