In nature, materials exhibit different properties of rigidity and structural responsiveness to the forces on them. Many materials are flexible and deform when acted upon by forces such as gravity and friction. Blender’s soft body simulation enables you to easily represent the behavior of a wide variety of flexible materials. Depending on the parameter settings you use, you can use soft body simulations to animate materials as varied as gelatin, sheet metal, and cloth.
In this chapter, you will learn to
One of the basic aspects of animating with meshes is mesh deformation. In Blender, there are many ways to deform a mesh. You can use shape keys, hooks, and modifiers such as armatures, lattices, curves, displacement, waves, and others. Each of these methods enables different kinds of deformations, and the combination of them yields a considerable amount of control for animators. Nevertheless, some kinds of deformations are still difficult or impossible to achieve convincingly without a dedicated simulation. Soft body physics is a good example of this kind of deformation.
Soft body dynamics refers to the way that flexible materials deform in response to the forces on them. In real life, many things we deal with all the time exhibit soft body behavior: cloth, rubber, paper—even metal, when under the right kinds of stress. These objects bounce, crumple, and jiggle in ways that would often not be practical to animate by hand. By setting up a soft body simulator, you can get Blender to do the work for you.
Soft body simulation is one of Blender’s physics simulation functions, which are found in the Physics properties area shown in , when an appropriate object is selected in the 3D viewport.
Physics properties
Soft body dynamics works by treating a mesh as a network of springs. In the default case, the edges of the mesh are given springlike behavior, as visualized in .
Mesh edges are treated as springs in soft body simulation.
When a soft body simulation has been created on an object, you can set parameters to determine how these “springs” react to forces and how the soft body simulation itself interacts with the mesh. These parameters can be set in the Soft Body tab in the Physics properties area shown in , after you have activated soft bodies for an object by clicking Soft Body. The parameters to determine forces are as follows:
The Soft Body Goal and Soft Body Edges check box options restrict the freedom of the soft body simulation’s movement.
Soft body properties
Edge damping works similarly to hydraulic shock absorbers.
Diagonals are also treated as springs when Stiff Quads is selected.
Soft body simulations can be baked to a cache for quicker access in subsequent plays of the animation. Baking for soft bodies and cloth is done on the Soft Body Cache tab, shown in . Simply enter the values of the start and end frames for the time period you want to bake, and click the Bake button. You can also manage multiple caches on this tab, so that multiple simulations will not be overwritten.
Soft Body Cache properties
Because springlike behavior is so central to the way soft bodies work, this section demonstrates the simplest possible soft body setup, just a single edge, by using it to drive the motion of a posable spring. You can find the file bouncing_spring.blend on the website for this book. To create a Soft Body object that will control the movement of the spring, follow these steps:
Add a Mesh object.
Delete all but two vertices, connected by an edge.
Select the lower control bone and snap the cursor to it.
Snap one vertex to the cursor.
Add an empty.
Bone-parent the Mesh object.
Vertex-parent the empty.
A Copy Location constraint on the control bone
Now it’s time to set up the Soft Body object. A common way to control soft bodies is by use of a vertex group and a goal. When this option is used, vertices that have a high weight for the group are fixed in place to the mesh’s ordinary shape (including any non-soft-body deformations) and are not influenced by the soft body simulation. Vertices with a low goal weight are freer to move around in accordance with the soft body simulation. The Mesh object in this example has only two vertices. You will use a goal vertex group to nail the top vertex in place, while allowing the bottom vertex to exhibit soft body behavior:
Assign the top vertex to the SoftGoal vertex group.
Finally, activate the soft body simulation. Return to Object mode, and with the Mesh object still selected, click the Soft Body button on the Soft Body tab in the Physics buttons area.
The point of these three tutorials was to set up the simplest and most explicit possible example of what soft bodies actually do. You should experiment with this spring to find out how the different soft body parameters affect its behavior. Try changing the mass, stiffness, and speed values and see what happens. Try animating the location and rotation of the soft body mesh (remember, the armature is constrained to follow the empties, and the empties are vertex-parented to the mesh). If you bake the soft body and then animate the object, what happens? (Hint: To do this right, you’ll need to free the bake by clicking Free Bake in Bake Settings.)
Soft body simulation values
Soft body spring in action
Soft bodies can interact with other objects and forces in much the same way that particle systems can, as described in Chapter 6, “Working with Particles.” Forces behave essentially the same for both particles and soft bodies. Soft body collision is slightly different from collision for particles. There is no permeability parameter, but there are two parameters, Inner and Outer, that create the effect of a thickening of the internal or external surface of the Collision object. The optimal settings for these values vary depending on the situation, but a general rule is that increasing the value of one of these parameters should help diminish penetration from that side of the mesh. As you’ll see, there are other ways to minimize penetration, if these parameters don’t do the trick. The Damping value here has essentially the same function as the Damping value for particles collision: It reduces the amount of kinetic energy in the deflected object when it collides, resulting in a less-bouncy collision.
Collision detection between Soft Body objects and Collision objects is good but not perfect. Even with Inner and Outer thickness parameters set to their optimal values, penetration can occur.
Soft Body objects also can be Deflector objects and interact with other Soft Body objects, as in the case of the balls in the file bouncy_balls.blend, shown in .
The balls are initially set up as shown in , with the plane beneath them set as a Deflector object.
Soft balls bouncing together
Ball setup
The balls’ own Soft Body settings are shown in . Note especially the Bending value. This refers to the amount of resistance there is to bending at the vertices. The default is 0. To make the balls maintain their shape, Bending must be set to a higher value. A value of 1 will give the balls about the hardness of a well-inflated soccer ball. I’ve set the value to 0.8, which as you can see results in much softer-seeming balls.
Soft Body settings for the balls
Soft body simulations can provide a stretchy, flexible surface effect similar to cloth. In fact, in the past the best way to simulate cloth in Blender was to use soft body effects. However, Blender now features a dedicated cloth solver, which is a great improvement. Real cloth bunches together and influences its own motion by colliding with itself. The cloth simulator is more accurate and stable for these uses than soft bodies. shows the cloth simulator in action.
Cloth simulation
shows a still from an animation of drapes that uses both force fields and Collision objects. You’ll find a similar but somewhat simpler scene among the downloadable files for this book.
Animated cloth drapes with forces and collision
The file drapes.blend features the scene shown in .
Simple drapes scene
You can see the cloth settings for this setup in . It is important to activate Self Collision for cloth in order to avoid the object penetrating itself. The drapes themselves are simply subdivided planes.
Cloth settings for the drapes
A goal vertex group is used to fix the drapes in place, and you can see the values of the vertices shown in Weight Paint mode in .
Wind is produced by the Force Field object shown in . The settings for the force field are shown in .
The Collision object is a simple cylinder. The Collision settings for that object are shown in .
Goal vertex weights displayed in Weight Paint mode
The Force Field object
Force Field settings
Collision settings for the pole
Creating clothing for animated characters is a very important and often poorly understood use of the cloth solver. It’s important to understand how to get the most of it.
Obviously, not every article of clothing that is made out of cloth in real life should be represented with a cloth simulator in CG. Some clothing articles are best modeled and rigged in the traditional way, without simulation. Clothing that is stiff or tight fitting generally doesn’t require simulation and won’t be well mimicked in this way. Articles of clothing that billow or bunch up are appropriate for cloth simulation. There are often cases where part of an article of clothing should be simulated and other parts, such as the bodice portion of a dress, should not be simulated. This can be accomplished by using vertex groups and weight painting to pin portions of the clothing that are not subject to the simulation.
When animating cloth simulation there are several issues to be aware of. You need to ensure that any potential areas of penetration are avoided or concealed. You need to make sure that the movement of the cloth is doing what you want it to and avoid wrong behaviors such as the cloth squirming when it should be resting motionlessly. Finally, you need to be prepared to bake full-quality simulations for every animated sequence involving the cloth if necessary, which can be resource intensive. But in many cases it’s not necessary.
Another question is whether to use the soft body simulator as is to provide the animation of the cloth itself or to use it as a modeling aid. In the case of a billowing, flowing dress, you would probably use the animation data directly from the soft body simulation, subject to force fields. This can be difficult to work with because the animation cannot really be controlled directly. In other cases, such as stiff boots or tight, form-fitting clothing, any kind of cloth simulation is probably inappropriate.
The most common kind of clothing resides somewhere between these two extremes. Most clothing is made of cloth, after all, and has characteristic wrinkles and perturbations whenever it is worn. However, the perturbations in ordinary-to-tight-fitting clothing do not change drastically in response to a character’s movement. The wrinkles behind the knee in a pair of jeans, for example, do not substantially change their arrangement when a person’s knee bends. You can take advantage of this by using Blender’s cloth simulation functionality not as an animation tool but as a modeling tool. Using cloth simulation you can create a static mesh that can be rigged in the ordinary way, resulting in highly realistic clothing without the extra challenges of animated cloth simulation.
The following tutorial will show you how to use cloth simulation along with an armature-rigged base body mesh (in this case just an arm) to create a sleeve. You can extrapolate what you learn here to create the rest of a shirt or any other piece of clothing.
In order to follow the steps you’ll need to prepare a bit. If you don’t want to model and rig the base mesh and armature yourself, you can append the group Arm_Rig from the file arm_sleeve.blend found on the website that accompanies this book. If you are comfortable with basic mesh modeling and rigging and would prefer to model and rig the starting point yourself, refer to for the topology used.
Three views of an arm model
Your model doesn’t need to be identical, but it should be a nicely modeled arm that will deform well. Note that the polygons are fairly uniform in their size and proportions. The armature used is shown in .
Parent the mesh to the armature and select Create From Bone Heat, as shown in . The arm should deform nicely, as shown in .
Adding an armature
Rigging the arm with bone heat–based weights
Posing the rigged arm
To minimize clutter, put the armature in Stick view mode by selecting Stick from the Display options on the Armature buttons panel, shown in .
Settings for the armature
Once you’ve either appended the group or modeled and rigged an arm of your own, follow these steps to create the shirt sleeve:
Adding a cylinder
Parameters for the cylinder
The new cylinder mesh
Rotating, scaling, and placing the cylinder
Extending the cylinder into a sleeve shape
Adjusting for multiple cuts
The mesh with new loops cut
Activating Proportional Editing
Adjusting the mesh with Proportional Editing
The adjusted sleeve mesh, without penetration from the arm
Adding a Shrinkwrap modifier
Settings for the Shrinkwrap modifier
The Shrinkwrap-modified sleeve mesh
Editing the shoulder seam by hand
Modeling the cuff of the sleeve
Adding a vertex group
Setting vertex weights for the loop near the seam
Setting vertex weights for the seam and the cuff
The sleeve in Weight Paint mode
Rigging the sleeve
The rigged sleeve in Weight Paint mode
A good way to get interesting-looking cloth wrinkles is to run the cloth simulation over a posed model set up as an obstacle to the cloth. The cloth effects can be even more dynamic and convincing if, rather than using a statically posed model, you animate the model into the pose and let the cloth simulation play out over the animated mesh.
The starting pose for the modeling action
The ending pose for the action keyframed at about frame 70
Setting Subsurf modifier values
Setting the arm as a Collision object
Cloth simulation settings
Once the cloth simulation is baked, you should be able to move back and forth along the timeline at normal speed and see the mesh at the corresponding state in the cloth simulation. The simulation frames have all been saved, so they can be quickly accessed without further computation. This simulation, however, is only appropriate for this specific animated shot. If you want to use the simulation to create a new static mesh model, follow the next steps:
The modifier stack before applying each modifier from top to bottom
Applying the pose as the rest pose
Rigging the new sleeve mesh to the new armature
The Arm mesh object with unseen vertices deleted
You’re basically finished now. Test your mesh by creating a simple action with a range of positions roughly representative of what your character will be doing so that you get a sense of how the sleeve will look when bent and extended in different ways. shows renders of the same process but with the Subsurf level set at 3 and with Self Collision activated on the cloth simulation. If your resources allow, try running a simulation with these settings as well.
A rendered sequence using level 3 subsurfing