From BlenderWiki

Jump to: navigation, search

The Basics

Main Panel

The Soft Body panel enabled
  • Enable Soft Body: Enables this object to act as a Soft Body
  • Bake Settings: Enable the simulation to be saved as vertex positions.
  • Friction: A generic force against movement that acts on all vertices. A value of zero means no Friction
  • Mass: The mass of the body in kilograms. Will be shared equally among all vertices. A higher mass will make the object harder to stop, and the action of force fields will be smaller
  • Grav: The local gravity, it´s always pointing the negative z-axis
  • Speed: A tweak used while solving the movement. Don´t modify, unless you have a good reason to do so.
  • Error Limit: The biggest amount of error the calculation solver may commit. A smaller value means more realistic results, but more baking time also.

  • Use Goal: Enables creating a force to try to keep all the vertice to a position. Use the double arrow on the right of Use Goal to select what vertex group you wish for all the vertices to try to keep position.
  • Goal: If no vertex group is defined, this defines that all vertices should try to keep their respective position.
  • G Stiff: The intensity of the force that will be onto all vertices (even those not in direct contact with the goal). Most of the times, this is set to zero, or a very small value.
  • G Damp: This adds some friction to the Goal Movement.
  • G Min and G Max: These redefine the weight of the vertex groups defined, if any.

  • Use Edges: Add springs on edges. For most of the times, keep this on.
  • Stiff Quads: On faces with for vertices, add springs also on the diagonals
  • E Stiff: The spring stiffness. A value of zero means the spring offers no resistance to movement (It all happens as if no spring was there). A value of one means the spring cannot be streched (as if was there a solid rod). However, a value of one would make calculations impossible, so, the maximum is 0.999 . A elastic material has E Stiff on the range of 0.3 to 0.7 . Most type of cloths, like cotton, leather, linen, etc ; that cannot be stretched a lot have E Stiff on the range of 0.95 to 0.99
  • E Damp: Add some friction to the movement of the springs. If you set this to zero you may get a non-real, never ending movement.

Bake Settings

  • Start: The starting frame
  • End: The last frame
  • Interval: The interval between frames that a shape key of the object will be saved. Unless this will cost you much memory, keep this at 1, by storing all frames, to achieve more realistic results
  • Bake: Starts processing the soft body interaction between the selected frames. After you bake, if you enter in edit mode on the soft body object, when you leave, it will erase the baking, even if you haven´t modified anything. Try putting the use of Bake at the very bottom of your production flow, one of the last step, mainly when it´s a baking that takes some time.

Deflection Settings

The deflection panel enabled

Now, we only use the soft body settings:

  • Damping: The some friction that happens upon the soft body contact.
  • Inner: The maximum length the soft body may get inside the object.
  • Outer: A distance from which the soft body starts executing forces on the object.

Towel falling onto table

As our first example, we will try to simulate a towel falling onto a table.

Prerequisites: You need to know Blender interface, and the very basics of mesh modelling (scaling, moving)

We will need a cube, to be the top of the table, and a plane, to be the towel.

The scene setup setup. The plane on top is the towel, the box below is our table.

Then, while the plane is selected, enter edit mode, enter Editing F9 select all vertices, click subdivide some times (4 to 6 times), then leave edit mode, click Enable Soft Body. Do not forget to subdivide the plane mesh. Only the vertices are taken into account in the collision calculation. If you set a collision object, and it does´t face any vertices, the soft body will pass trough.

As we want our towel to fall onto the table, we will need some gravity. Set gravity to 10. The gravity here point to Z negative global axis. Also, deselect Use Goal as we want our towel to move freely.

Select our table, and go to the object panel ( F7 ), then Fields and Deflection, check the box Deflection.

If you bake the soft body now, you will already get some good looking results. Problems may arise if the borders of the towel touch each other, they may keep fixed. Try to avoid this, either by decreasing Error Limit or by scaling down the towel, so it would be physically impossible for it to happen.

The first result after baking. You can see the towel has entered inside the table. Now we will fix it by increasing Outer.

After this first result, the towel was rotated 45 degrees, the parameter Outer was increased, and a nice texture was applied. The render results.

frame 15
frame 20
frame 30

Animating a soft block hitting a wall

What we call here as block is a 3d object with an internal volume, like a cube, a cone, or a cylinder with the ends closed. A plane, or a cylinder with the ends open have no internal volume.

As we have seen, the method Blender uses to simulate a soft body is to put masses in the vertices, and springs on the edges. If you use the same method you used to simulate the towel to simulate a cube hitting a wall, (Add a cube, subdivide it some, and simulate it´s collision with a solid plane, it will probably collapse (fall inside itself, like the rendered picture below). So why does this happen?

Frame 14. Impact
Frame 19
Frame 24
Frame 35. Fully collapsed structure.

It happens because with the method used by Blender, this cube simulated is like a cube of a thin foil (like aluminium foil) falling. Of course, it is unavoidable for a cube of thin foil to be a part of such a event and be intact after.

The type of block needed, with vertices inside it.

So to simulate a good collision of a volumetric solid, we need to build a mesh that also contains vertices inside it, in an organized way, so the object resists to be compressed or stretched also inside, not just the walls. The approach we will use consists in using small cubes as build blocks of our objects. It can be seen from the images below that it produced good-looking results.

This is one method to build such a mesh. You can use others if you want. Insert a cube, scale it to half the size (exact). Enter edit mode, enter Editing F9 select all vertices,Step=6 (in our example) and while in front view click Extrude Dup. Don´t leave edit mode. Go to top view, select all vertices, and Extrude Dup. Go to side view, select all vertice, and Extrude dup. If you done everything correctly, you will arise to a mesh like this. Now, select all vertices, and click Remove Doubles, to remove all overlapping vertices that arisen from extrude dup. Check ok.

Attention for normals

In the softbody solid example, when we remove the doubles, half the face normals are up, and half will be down. If you will use something that depends on the face normals, like Set as Smooth, you will need to manually flip the normals in the correct way, since the command Recalculate Normals Outside does not work.

Now go to the object panel ( F7 ). Select the plane below the cube, and enable it for softbody deflection. Select the cube, and Enable Soft Body. Select a Gravity of 10, uncheck Use Goal, use Stiff Quads select E Stiff to about 0.4. Use the Bake Settings, and bake. It may take a while, about 2 to 5 minutes to bake 100 frames.

The results. Even being simple to do, the final results are very realistic. A much more realistic approach would be possible if you did a mesh with more cells. It was 6 on our example. However, if you use a side of 12 cells, you will increase calculation time 8 times. If you use a side of 25 cells, the calculation time will be about 70 times our example.

Frame 29. Impact
Frame 36.Compression
Frame 40. Max Compression
Frame 51. Started bouncing back
Frame 52. In the air again
Frame 56. In the air. Streching. Very realistic "jelly" effect

Simulating a flag in a pole

With this example it will be seen how to use forces on soft bodies. We will simulate a flag on a pole with wind.

Add a plane in the front view, rotate it about 45 degrees on the y-axis. Enter edit mode, subdivide the mesh three times, and we now will select which vertices will be fixed by creating a vertex group. Select the vertices as shown in the picture, then create a new vertex group with them selected (we will call it "pole").

Assigning the vertex group
The vertex group selected: The yellow dots.

Now, enable the flag to be a Soft Body, and use the vertices we selected as Goal.

Enabling the selected vertex group to be the goal

Select G Stiff as zero, and E Stiff as 0.975. If you see what is happening to the flag by either baking or advancing frames, you will see that it only falls down. It happens because we don´t have wind yet. To add wind, press Spacebar > Add > Empty. With the Empty selected, go to the Physics buttons, and select Fields > Wind. Imput a non-zero strength, just to see where the wind is pointing. Now rotate the empty so the wind faces the flag. Now it´s time to see what Strength is more adequate. In my setup, to get a good soft wind effect, I used a strength of 0.05, if you use something like this you will get results similar to mine. If you set the strength to 1.00 in this setup, you are more likely to get a hurricane.

The wind setup

To get a nice result, a texture is added, edge rendering (to get a cartoon look), add the pole (a stretched cube) and a wall and you get this cartoon flag. Even though it is cartoonish look, it is still very realistic in its movement.

Frame 1
Frame 9
Frame 18
Frame 27
Frame 36
Frame 45

Fine Tuning of Properties and Hints

  • Most fiber cloth (cotton, linen, etc) you should consider not having Spring Quads, for a better simulation. For materials that are fiberless, like leather and plastic, enable Spring Quads. For most cloth materials, E Stiff is greater than 0.975. If you use a value below this, you will get to non-real looking results.
  • Decreasing Error Limit always leads to better results, but also a significant increase in baking time.
  • The procedures used to create our soft block only can be used to create box-shaped objects, to produce curved objects you will have to try other approaches to generate the mesh.
  • The smaller the Interval when baking, the more realistic movement. Unless you have a strong reason to do otherwise, set it to 1.
  • Applying the subdivision modifier is not recommended, instead, subdivide the mesh. While in edit mode (⇆ Tab key) press F9 and select Subdivide a few times. Each time you subdivide the mesh, the number of its faces is multiplied by four.
  • When the Soft body has not been baked yet, the calculation will only be done if you keep going forward in the animation. If you rewind a single frame, it will reset all of the calculation. Also, when you are about to render, bake the simulation, it will improve the render speed a bit.
  • The more you subdivide the mesh of the soft body, more accurate your simulation will be.
  • The smaller the E Stiff, the higher the probability of collapsing if you are working with a soft solid. A soft body collapsing is not always an error in design. In the real world, if you let an object fall from an great height, it will break too. Depending on the setting (high impact speed, relatively low number of vertices in the impact, aka corner impact) , it will be impossible for the object to not collapse.
  • As of now, you cannot simulate the collision of two soft bodies, only a soft body VS hard body collision.
  • A value of Stiffness above 0.99 will increase baking time a lot, so try not to put it above this.