The next type of simulation we will discuss is a cloth simulation. This is one of the easier simulations to work with, but it is also quite complex due to the amount of internal and external interactions it will have. This simulation makes things that would otherwise be very difficult to model—such as tablecloths, flags, and blankets—super simple and easy to create! Normally, it’s used to create two-dimensional (2D) things such as the examples I just mentioned, but it can also be used to create pillows, stuffed animals, and even balloons!
The goal of this chapter is to give you an understanding of how cloth simulations work in Blender and what all the settings and values do. Just as with the previous chapters, we will start by learning what a cloth simulation is, then we will jump straight into the settings.
Here are the topics we will cover:
This chapter requires you to have Blender version 3.0 or above installed.
To download Blender, visit www.blender.org.
A cloth simulation in Blender is used to simulate the behavior and interactions of cloth in the real world. It is great for creating things such as fabrics, blankets, pillows, flags, and much more. While you can get similar results using a soft body simulation, a cloth simulation is designed and better suited for this type of thing, and you will generally get better results. You can see an example of a cloth simulation here:
Figure 8.1 – Cloth simulation example
The cloth calculates and simulates its physical properties by creating virtual springs that are connected to each vertex of the object. These springs control how stiff the cloth will be, how much it will bend, or how much it will resist collapsing. There are four types that you need to remember, as outlined here:
We will be covering these springs in a bit more depth, and you will see examples of how they work later in this chapter!
To add a cloth simulation to your object, first head over to the Physics panel, then select Cloth, as illustrated in the following screenshot:
Figure 8.2 – Physics cloth simulation
One thing to keep in mind before you start simulating is the amount of geometry on your object. You need to have enough geometry on the mesh for it to simulate and deform. If you try to add a cloth simulation to a plane with only four vertices, that’s not going to work very well. Likewise, if you have too much geometry, the simulation will slow down and take longer to calculate and bake.
A good idea would be to have enough geometry to get a nice simulation and then add a Subdivision Surface modifier on top. This will smooth out the cloth and make it look much better while not impacting the performance. You can view the differences by looking at the following screenshot:
Figure 8.3 – Subdivision Surface modifier
If you add the Subdivision Surface modifier above the Cloth modifier, the simulation will take that extra geometry into account when simulating. Therefore, make sure to add the Subdivision Surface modifier below the Cloth modifier, as shown in the following screenshot:
Figure 8.4 – Cloth and Subdivision Surface modifiers
Another thing to note is when you apply the Cloth modifier, it will lock the cloth in place, and from here, you will be able to go into Edit Mode and see the geometry. This will also remove the modifier and you won’t be able to simulate anymore. Why would you want to apply a modifier? Well, this can be very useful when you want to create an animation but you want the cloth to remain still, like a blanket draped over a couch or a towel hanging from a hook.
Now, before we jump straight into the settings of the cloth, it’s important to discuss collision objects and how they can interact with the simulation!
We discussed collisions in Chapter 6, Getting Started with Soft Bodies, and it works basically the same way with cloth objects. You first need to select a mesh you want to add collision to, then head over to the Physics panel and select Collision. This will also add the Collision modifier in the Modifier panel.
Keep the modifier stack in mind when working with collisions. You need to make sure that the Collision modifier is at the very bottom of the stack; this way, Blender will accurately calculate the collision boundaries when simulating. The following example is of a cube with a Subdivision Surface modifier above and below the Collision modifier:
Figure 8.5 – Collision modifier stack
With the collision object selected, you will be able to see the settings in the Physics panel, like so:
Figure 8.6 – Collision settings
Let’s go through each one and talk about them, as follows:
Remember—if your collision seems to be acting strange, double-check the modifier stack and make sure it’s at the very bottom! With that out of the way, let’s jump straight into Cloth settings and properties!
Now that we understand what a cloth simulation is all about and how collision objects work, it’s time to jump into all the settings and values. You can see an overview of the Cloth settings here:
Figure 8.7 – Cloth settings
We are going to start out at the very top and work our way down, as follows:
Figure 8.8 – Presets
This is a quick and easy way to create different types of cloth. You can also create your own presets by giving them a name and hitting the + button.
Now, let’s move on to the different submenus of the cloth simulation, starting with Physical Properties! Here is where we will learn how the cloth behaves and interacts with collisions!
The Physical Properties settings of the cloth are exactly what they sound like. These settings and values change how stiff the cloth will be, how much it will weigh, and much more. When you are changing these settings, you need to think about what kind of cloth you are trying to create (leather, for example, will have a much higher stiffness than silk, and a comforter for a bed will weigh more than a thin blanket). You can see an overview of the settings here:
Figure 8.9 – Physical Properties
Again, let’s start out at the very top and work our way down and talk about each value, as follows:
Figure 8.10 – Bending models
Next up, let’s discuss the other tabs in the Physical Properties submenu, starting with Stiffness!
Below Bending Model, we have the Stiffness tab, as shown here:
Figure 8.11 – Stiffness settings
There are four options that we can change here, as outlined next:
Figure 8.12 – Compression example
Figure 8.13 – Bending example
The Damping tab has all the same settings listed in the Stiffness menu: Tension, Compression, Shear, and Bending. These values basically slow down the effect of each setting in the Stiffness tab.
For example, if the Compression option in the Stiffness tab is set at 0 but Compression in the Damping tab is set at 50, the cloth will still collapse but it’s going to take longer. If the Compression option in the Damping tab were also set at 0, then the cloth would collapse instantly and lose all its structure. So, again, these settings slow and dampen the effect of each option in the Stiffness tab.
Checking the Internal Springs box will basically turn your cloth into a soft body.
Remember earlier in this chapter we talked about springs for a cloth simulation? Well, normally, springs can only be applied to 2D surfaces, but when Internal Springs is enabled, three-dimensional (3D) springs will be created inside the object, and now, it will behave very similarly to a soft body.
When you check the Internal Springs box, these options will be available:
Figure 8.14 – Internal Springs settings
Let’s go through each of them, as follows:
Figure 8.15 – Max Spring Creation Length
Figure 8.16 – Check Surface Normals example
With that done, let’s take a look at Pressure!
Enabling Pressure will allow you to inflate your cloth, which can be very useful for creating things such as pillows or balloons. You can see an overview of the settings here:
Figure 8.17 – Pressure settings
Let’s discuss the settings, as follows:
Figure 8.18 – Pressure example
Figure 8.19 – Pressure volume example
When it is checked, the size of the mesh will be calculated when applying pressure. In the following screenshot example, Target Volume is set at 15 for each cube. Since the bigger cube has a larger volume, the pressure is not going to be as strong as the smaller cube:
Figure 8.20 – Target Volume example
Using a vertex group for the pressure
When selecting a vertex group to determine where the mesh has pressure, you may experience some strange movement. Due to the pressure on one side of the mesh, it will force the cloth to fly off in that direction. This may not be how it’s intended to work but keep that in mind if you decide to use this feature!
Figure 8.21 – Pressure vertex group
Now, let’s move on to the Cache tab and learn how to bake the simulation!
The Cache tab is where you bake in the simulation. It’s usually a good idea to bake in the simulation before you render it, just to make sure everything works correctly, but it’s not necessary.
The Cache tab may look familiar; that’s because it’s the same as the Soft Body Cache tab, as we can see here:
Figure 8.22 – Cache
You should already know how all this works because we went over it in Chapter 6, Getting Started with Soft Bodies, but here are some quick notes just in case you wish to recapitulate:
The great thing about baking in the simulation is you can skip to any frame in the Timeline and preview what the cloth will look like in that frame. Without baking it in, you won’t be able to skip any frames; rather, you will have to play the simulation from the start.
As for the rest of the settings, since we have already discussed them in Chapter 6, Getting Started with Soft Bodies, let’s go ahead and move on to the Shape tab!
The Shape tab allows you to pin vertices in place. This can be very useful for creating things such as flags, a towel hanging from a hook, a hammock, or anything where cloth is pinned to something.
To get the cloth to be pinned in a certain place, first go into Edit Mode and select the parts of the mesh you want to pin, as illustrated in the following screenshot:
Figure 8.23 – Selected vertices
Next, head over to the Object Data panel and create a new vertex group by clicking the + button. Make sure the Weight value is set to 1 and click Assign. You can see an overview of this in the following screenshot:
Figure 8.24 – Assigned vertex group
Over in the cloth simulation, select that vertex group in the Pin Group menu, as illustrated here:
Figure 8.25 – Pin Group
Now, when you play your animation, those vertices you assigned will be stuck in place!
Your cloth will now be pinned in those places you assigned. Let’s talk about the rest of the settings, as follows:
Figure 8.26 – Shape stiffness
Figure 8.27 – Sewing edges example
After that, enable Sewing and play the animation. Your cloth should now close together where those edges are connected, as shown in the following screenshot:
Figure 8.28 – Sewing example
Figure 8.29 – Shrinking Factor example
Finally, Dynamic Mesh enables the sewing to allow any animation or deformation modifiers applied to the mesh (this could be an armature, lattice, and so on). When enabled, every frame of the simulation is recalculated to give more accurate results when those modifiers are in use.
Now that we understand the Shape tab, let’s move on to the Collision tab and learn about how the cloth collides with other objects!
Now, it’s time for all the Collision settings and values. Here is where we set up the quality, the distance, and if we want the cloth to collide with itself.
As I mentioned earlier in the chapter, to get the cloth to collide with something, we need to give that object collision in the Physics panel. Then, in the Cloth settings, make sure the Object Collisions box is checked (it should already be checked by default; unchecked will mean the cloth will just pass through any collisions). You can see an illustration of this in the following screenshot:
Figure 8.30 – Cloth collision settings
Now, your cloth should collide with the object, so let’s go through the settings and talk about each one, as follows:
The Friction option within the Self Collisions menu relates to how slippery the cloth will be when it collides with itself. The value you set here depends on the type of cloth you are trying to create. For example, a cotton blanket will have much higher friction than a silk one.
We have already discussed the rest of the settings, and they are used the same, except they apply to the self-collision.
Remember when we discussed the different spring types earlier in this chapter? Well, the Property Weights tab allows you to fine-tune those springs for the cloth using vertex groups. This can be very useful if you want some parts of the cloth to have different physical properties. For example, you can set some parts of the cloth to have more tension using the Structural Group type or shrink down using the Shrinking Group type.
Another example would be creating a blanket with different materials. If some parts of the blanket bend and wrinkle more than others, you can use the Bending Group type. And of course, if you want some parts of the cloth to collapse and shear less, you can use the Shear Group type.
You can see the different group types in the following screenshot:
Figure 8.31 – Property Weights
To use property weights, you first create a vertex group and assign vertices to it. In this example, I have assigned half of the vertices on this plane to a weight of 1:
Figure 8.32 – Plane vertex group
Then, in the Property Weights tab, I set Max Tension and Max Compression to 100. I also set Max Bending to 15 and assigned all the vertex groups. Now, when the simulation plays and it collides with the sphere underneath, you can see that half of the plane is very stiff and the other half is loose, as depicted here:
Figure 8.33 – Property Weights example
So, again, the Property Weights tab allows you to fine-tune certain areas on your cloth to have certain physical properties. Now, before this tutorial ends let’s quickly discuss the Field Weights tab!
Finally, the last tab in the cloth simulation settings is the Field Weights tab. Here, you can fine-tune how force fields affect your cloth. You can see an overview of this tab here:
Figure 8.34 – Field Weights
Here, Effector Collection allows you to limit which collection will affect the cloth. If no collection is set, then every force field in the scene will interact with the simulation.
You also have the option to change the Gravity value of the simulation. Do you want your cloth to float like it’s in space? Just set the Gravity value to 0 and you’re good to go!
As for the rest of the values, they control how strong of an effect the force fields will have. For example, if Wind is set at 0.5, then only half of any wind force field’s strength will affect the cloth. This can be useful if you have multiple cloths and you want the wind to affect each one differently!
And there we go! We have covered every single setting for a cloth simulation in Blender. With that done, let’s do a quick summary!
We have discussed around 60 settings and values in this chapter so far. This can be quite a lot to remember, so you can always reference this chapter if you forget what something does. As for right now, let’s do a quick recap to go over what we learned!
First, we talked about what a cloth simulation is, the importance of the modifier stack, and how the cloth simulates using different springs. After that, we learned about collision objects and how they interact with the simulation. And then, we went over every setting for the cloth. We discussed the physical properties, the internal springs, pressure, pinning, cloth collisions, and property weights.
Modeling a tablecloth with realistic wrinkles and folds can be challenging and take a long time. Thankfully, with a cloth simulation, it can save you many hours from having to do that. Hopefully, this chapter gave you a good understanding of this simulation and how it works. And in the next chapter, we will be putting those skills to the test by creating a realistic flag using this system!
3.137.188.11