This tutorial will demonstrate how to use the cloth simulation in XSI 3.0.
SoftImage XSI has gotten a bit of a bad reputation that it's cloth simulation isn't very good. But this tutorial will show you that you can actually achieve realistic results. We will cover various types of cloth from curtains and table cloths to more advance cloth setup such as clothes.
To start with will create a basic grid that will fall under gravity and interact with a basic object - a sphere. First we need to create the cloth, this will be a simple grid plane. Get->Primitive->Polygon Mesh->Grid. With the grid still selected, go to the Simulate menu (press 4 on keyboard) and then to Create->Cloth->From Selection. A dialogue box pops up, you can ignore that for now, we will cover that later. Next we want to get the cloth to move. As cloth never moves on its own (in the real world that is), it is usually affected by some external force, wind, gravity, collision etc.
We will start off with gravity. Get->Force->Gravity. Select your grid/cloth and then Modify->Environment->Apply Force and select the Gravity icon (right click to end picking). If you now click play, you will see the cloth fall under gravity. Next we will introduce collisions. Get->Primitive->Polygon Mesh->Sphere. Place the sphere underneath the cloth. Select the cloth and go to Modify->Environment->Set Obstacle. Click the sphere. The cloth is now setup to collide with the sphere. A new dialogue box now pops up.
This window displays the parameters for the cloth-sphere collision. Before we try to fine tune the cloth, first play the animation and see how the cloth-sphere collision works. You may have to make your cloth simulation run longer as the default time is 100 frames. To do this, select the cloth, and go to Select and click on ClothOp, this will bring the cloth settings dialogue box up again.
Under Range change the end frame number so the cloth simulation will last longer.
Now play the animation again, and you will see the cloth land on the sphere and the cloth will deform into a spherical like shape. However, you will notice that you see the sphere through the cloth.
There are a number of different ways to try and solve this. One is to increase the number of polygons in the grid and sphere, so the simulation has more points to calculate and is more accurate. Another is to increase iterations per frame, this number determines how many times the collision is checked per frame. So if the cloth went through the sphere, it would try and recalculate and move the cloth back on top of the sphere. These techniques are sometimes very good for some circumstances, but take longer to calculate. For a fast result, you can change a parameter called Push Length. This controls the offset between the cloth and the sphere's surface. So for instance, as the cloth goes thought the sphere, by increasing the Push Length to say 0.2, the cloth now collides 0.2 units above the sphere. This causing the cloth not to go through the sphere.
As I mentioned above, you can increase the amount of polygons in your cloth, this will make your cloth animate smoother and look more realistic. This animation
shows a cloth draping over two spheres.
I have adjusted the Friction setting, so the cloth doesn't slide off so quickly, but this can be good if you want to simulate a material like silk.
Next I will create a curtain. This introduces new techniques as wind (very similar to gravity) and nails. Here I created a basic wall with a hole for a window and a simple grid for the curtain. There are two ways you can keep the top of the curtain nailed to the wall. One way is to use the setting called Nail or using clusters. We will first cover the Nail technique. This is basically the same as the cluster technique, they both overlap really. First select your grid/curtain and Create->Cloth->From Selection. Then to pin this to the wall, go into tag/point mode (press 'T') and select the top row of points that you wish to pin to the wall. Create->Cloth->Local Cloth Cluster will apply separate cloth parameters to the top row. You can then select the Nail parameter.
This means that this top row will not move at all, no matter what forces are applied to it, but the rest of the cloth will, as it has it's own separate cloth simulation applied to it. To do this same effect without using nails, you can select all the points on the cloth excpect the top row and apply a cloth simualtion, this means the curtain will move like cloth, except the top row will stay stationary as it has no simualtion applied to it. Now for a curtain to blow in the wind, we have to apply a wind force. Get->Force->Wind. Applying the wind to the cloth is the same as applying gravity. Select the cloth then Modify->Environment->Apply Force and select the wind icon. If you animate the strength of the wind, you can get the cloth to flap. This animation
shows a cloth flapping in the wind.
Next we will look at creating more advanced cloth simulations, such as clothing for characters. This is when the problems start to creep into the simulation (look at my old uni work - lol). A lot of tweaking is involved when creating clothes because there are a lot of factors to consider. There are a lot more collisions and more complex models involved. For instance, if you create a jacket on a human, there have to be a lot of collision tests as the model and cloth can never intersect. Also, humans arms can move around a lot in many different directions, so the cloth has to be able to flow with the body in all directions and collide appropriately.
There are a couple of ways to create an item of clothing for a character. Polys or NURBs. Personally I prefer polys because they are SO easy to model in XSI. Plus I love the subdivisions in XSI. You can subdivided a cloth object and it wont take any longer to calculate. With NURBs you can use the stitching tool in the cloth simulation. This allows you to join two NURBs surfaces together and they will move like one piece of cloth. This is especially helpful if you wanted to join a sleeve to a jacket.To start with we will create a basic sleeve on an arm. This will show how cloth can interact with an animated object (arm). To start with, create a basic cylinder for the arm. Get->Primitive->Polygon Mesh->Cylinder. I increased the subdivisions a bit, just to make the cylinder have a few more polygons so it interacts with the cloth well. I also moved a few of the points nearer to the centre of the cylinder because this will become an arm and it needs to bend in the middle. The more points in the middle - the nice it bends. (But saying this, the cloth will cover it, so you will never see - lol).
Next create a basic skeleton arm and envelope the cylinder to it. Animate Toolbar, Create->Skeleton->Draw 3D Chain. Position this in the centre of your cylinder with a joint in the middle of the cylinder to act as an elbow. Select the cylinder, Deform->Envelope->Set Envelope. Middle select the skeleton in the explorer view. Now if you move the null, you arm will bend. The basic arm is setup, now to create the cloth sleeve. I created a basic cylinder again, that was slightly bigger than the arm, I then deleted the polygons off both ends of the cylinder, so it would be hollow like a real sleeve.
Next to add the cloth sim. I wanted to keep the end of the sleeve fixed to the body - so the sleeve couldn't actually fall off the arm. So I only apply the cloth sim to everywhere on the sleeve except the end points. This way the cloth will work - but always stay fixed at one end.
Go to simulate toolbar, Create->Cloth->From Selection. Your sleeve will now flow, but stay fixed at the root. Now to add the forces and collision. Modify->Environment->Apply Force. Select the gravity icon. If you play the animation now, you will see the cloth fall downwards.
To make the cloth interact with the arm - Modify->Environment->Set Obstacle, select the arm. Up comes a new dialogue box. Set the obstacle type as Actual Shape, this will give a much more realistic interaction. If you play your animation, you will watch the cloth fall and stop when it hits the arm. As in the first example above, there are a number of ways to stop the arm poking through the cloth. If you change the Push Length to 0.2, this will cause the cloth to collide with the arm 0.2 units sooner, stopping the arm poke through.
To make it a bit more interesting we will now animate the arm, to see if the cloth works properly. Animate a basic animation of the arm bending and then play back. You will notice that the cloth interacts with the arm. You will notice that there are a lot of parameters you can change for the cloth simulation. An easy way to get a look you are after is to use the Presets tab. Here you can choose between a range of previously setup types of cloth. You can also change the friction between the cloth and the arm. Changing this can make the cloth slide off like silk, or stick to the arm. Changing the mass is a very helpful parameter, this can make your cloth look like a heavy piece of carpet or a light piece of silk flowing in the wind.
We will now create a clothes for a character, from a simple skirt to a jacket.
This image below is of a skirt, this cloth simulation was very east to setup. It is identical to the above example (the sleeve). The skirt is made from a cylinder with it's caps deleted. The top is constrained to the human's waist. Gravity is applied and the skirt is setup to collide with the human. The only real problems with this simulation was getting the skirt to move in the desired way. As in making its not too heavy and flows nicely. This animation
shows the skirt with the cloth simulation
applied to it.
We will now look at a full coat for a character. This is where things start to go wrong and a lot of tweaking is involved. But once you get the hang of it, you can get some nice results.
To start with you will need your character. Based on his shape/size you can build a coat around him. Make sure that your coat is hollow, this way the collision will work. If the arms are capped etc, the collision will not work correctly.
Once you have modelled your coat, check that there are no overlapping points. For example, the body is not poking through anywhere on the coat, this will cause the collisions to go wrong. On this setup, I constrained the top of the coat to the neck just in case the coat ever slid off, this way, his coat should always stay on.
To do this I selected the top row of points around the collar of the coat. I created a Cluster with Centre. This gave me a null that controlled the cluster, I constrained the null to the neck. So whenever the neck moved, the top of the coat would follow. Now, to get the rest of the coat to follow the body, we setup a cloth simulation. Select the remaining points on the coat (not the collar). Once gravity is applied and the body is setup as a collsion, the coat should move with the character as he animates. However, there probably will be a few problems that we need to iron out.
Firstly, you will notice that the body may poke through the coat in some areas. Now you could increase your meshes and iterations many times, this could solve it, but would drain your CPU. The best way is to just increase the Push Length as discussed in above examples. This should solve the collisions problems.
You'll probably notice that your coat maybe be very stretchy and bounce all over the place. This is because a few settings need fine tuning. Firstly, lower the Tolerance setting, this will increase the clothes accuracy. I wanted a heavier looking coat, at present this is too "flowy", so increasing the weight here helps. But the main parameters to adjust are under Stiffness - Resistance to... - these settings can greatly affect the look of your cloth. The Shear factor allows the cloth's quad to remain undeformed, keeping as much to the original shape as possible. Setting the Bend factor high, makes the cloth act like leather which is ideal for this coat, lower values create a more satin/silk look. Finally, increasing the Stretch value prevents the cloth from having elasticity. A lower value allows the cloth to deform without resistance. There are many more factors to consider, but I have covered the main, more important ones. The following animation
shows a quick test of the coat deforming as the character animates.
Any questions? E-mail me at email@example.com
and I'll see if I can help!