George Maestri
By George Maestri
From the author of Digital Character Animation 2, Volume II: Advanced TechniquesDigital Character Animation 2, Volume II: Advanced Techniques Cloth can be tough to simulate correctly because of its multiple properties. George Maestri offers some tips on making the process easier.
George Maestri is the author of several animation books from New Riders Publishing, including [Digital] Character Animation 2, Volume I and [Digital] Character Animation 2, Volume II. He is also the series editor for New Riders' [Digital] series of books, including [Digital] Lighting and Rendering and [Digital] Texturing and Painting.
Digital animation has come quite a long way in the past decade or so. The field of digital effects has been completely revolutionized, and, for character animators, there are new methods for bringing characters to life. These advances have come quickly, but even with this tremendous progress, we're still at the base of a very long road. A number of very difficult problems still need to be solved. One of the more vexing of these has been the simulation of cloth and realistic clothing.
Cloth is a tough nut to crack. When simulating cloth, a number of very sticky problems come into play. Cloth can be simulated using physical equations, but the equations are quite vexing and complicated to solve. A good example might be the cloth in a dress. The legs collide with the dress and push it around, but as the dress folds, the cloth of the dress collides with itself, geometrically increasing the number of collisions that need to be solved. Cloth also has elastic properties that can vary, depending on the weight and cut of the fabric. A fabric such as leather is fairly stiff, holding its shape much more than a loose fabric such as cotton or silk.
The problem has to be tackled on two fronts. The first is with sheer brute force. As machines get faster, it becomes easier to simply solve for all the collisions. The second tactic is to simplify the simulation so that you don't have to solve as many collisions, thus reducing the amount of brute force required.
Several commercial cloth plug-ins are on the market. Most of these plug-ins are still quite pricey, although costs are coming down. The big advantage to using a commercial cloth plug-in is that it is tuned for calculating the physics required for realistic simulation. So many of these plug-ins are available that it's hard to concentrate on one. Generally, however, these have a number of features in common.
All cloth software needs to calculate collisions between the cloth as well as other objects. The software also needs to create many different types of materials by varying the stiffness and elasticity of the cloth. This is usually created by simulating springs between the vertices of a fabric, much like a virtual box spring. When one vertex collides, it reacts and pulls the vertices around it. Those vertices pull their neighbors, and so on. Again, this adds to the number of equations that need to be solved. Finally, cloth needs to be capable of interacting with the environment. This means reacting to forces such as wind and gravity.
Animating Cloth
If you need to simulate cloth only occasionally, or if your cloth animation is simple (such as billowing flags or drapery), there are a number of tricks and ways of simulating cloth without using a fancy plug-in.The simplest way to create fake cloth is to simply animate it. This is certainly not as easy as it sounds because the shapes involved can be quite complex. Still, for simple animations, you can use some simple tricks. Software with morphing capabilities is one good option because it allows for the seamless transition from one complex shape to another.onsider a pair of bellbottom pants. Pants themselves are fairly easy to animate, but the motion of the bellbottoms can be tricky. There's also the issue of how the fabric of the pants stretches and creases as the legs move. If the character performs simple motions, such as walking or running, the motion of the pants is fairly simple as well.Typically, if the character is walking forward, there will be only a few positions of the pants—when the leg is forward (see Figure 1), back (see Figure 2), and somewhere in the middle. The motion of the fabric is simply a classic case of secondary motion. When the leg is moving forward, it pulls the pants forward, causing the fabric to be mostly behind the leg. When the leg is moving back, the fabric is mostly in front of the leg.
Soft Bodies
Another way to go is with a soft body dynamics system. For those with Maya or 3D Studio Max, a soft-body dynamics system provides one option for cloth. Soft-body dynamics treats each vertex in your mesh as a particle, which allows for real-world simulations. Many systems can also employ a simple mass spring mechanism, which is the underlying process for most commercial cloth plug-ins (although not as finely tuned). For Max users, flex is one option, and soft-body dynamics are another for those using Maya.Using a soft-body system can be a mixed bag. Because most soft-body systems cost as much as a cloth plug-in itself, it may behoove the animator to use a cloth simulator because most soft-body systems fall a bit short when it comes to the tough real-world simulations that cloth requires. On the other hand, although soft-body systems are not as finely tuned to the demands of cloth, they are more generic and versatile for many other types of effects.
Creating a Soft-Body Cape
Soft bodies might not be great for a complex garment such as a puffy shirt or a Chanel dress, but they can be employed to create simple clothing, such as a superhero cape or a simple skirt. Here's an easy way to make a cape using soft-body dynamics in Maya.
First, model a simple cape out of a 12x12 NURBS plane. Adjust the vertices so that the cape hangs around the shoulders somewhat naturally. Be sure to model in a few natural folds and irregularities in the surface, which will help keep the cape looking natural when the simulation is run.
Next, turn the cape into a soft body. This is done by pressing the Create Soft Body button under the Bodies menu. Bring up the dialog box and make sure that Enable Goal Weights is toggled on, which will keep each particle in place relative to the others.
Add some wind to the equation. From the Fields menu, select Create Air. Move the air away from the cape and make sure that the air is blowing toward it. To make the air affect the cape, select the cape and then the air icon; pull down Connect to Field from the Connect menu.
You can run the simulation by pressing the Play button. This will cause the entire cape to blow away. This is because all the vertices are weighted the same. Obviously, we need to find some way pin the cape to the shoulders. This is done by adjusting the individual goal weights of the particles so that the ones at the shoulders are rigid and the rest flap freely.
Rewind the animation and then select the cape. From the attribute editor, go to the particle page. In the goalPP (goal Per Particle) field, right-click and pull up the Connection Editor. This allows us to adjust the goals on a per-particle basis. Change the selection mask to Components and Particles. Now select the particles that need to be pinned to the shoulders. Set the Component Value to 1, which will make the points rigid. Next, select the row of vertices just outside this area, and set their Component values to 0.9 (see Figure 3). Work your way out from the shoulders, adjusting the weights accordingly. For those with Maya Artisan, the Script Paint tool can be used to paint the weights as well.
Figure 3 Weight the vertices in the cape so that the ones near the shoulders are stiffer.
Run the animation. The cape should stay in place at the shoulders, while the rest of it flaps in the breeze (see Figure 4). You'll also probably notice that the cape is stretching quite a bit. This can be fixed by adding springs, which, as mentioned, will help maintain the volume of the cloth. Highlight the cape and, from the Bodies menu, select Create Springs. Highlight the springs from the Outliner and hide them.
Figure 4 Adding some wind will make the cape flap in the breeze.
Now the cape should flap convincingly. You can always go back and adjust the goal weights to fine-tune the behavior. To further refine the animation, you could add a gravity field and also make the body of the superhero a collision object so that the cape never goes through the body once the wind dies down. Rendering the animation should give a nice result (see Figure 5). Other simple garments, such as a skirt, could be created in a similar manner.
Figure 5 Render the final animation.
Still, for more complex garments, sophisticated cloth plug-ins are the best bet. These will certainly help make animation more life-like and convincing than ever before.
Figure 2 As the leg plants, the cloth of the pants continues forward.
Getting the bottoms of the pants to move convincingly simply involves modeling the extremes. To add a natural touch, the targets should be modeled with folds and creases. The animation is then created by morphing between the targets as the character walks.
The walk, however, will probably be animated using bones, which, in turn, deform the mesh. The morphing of the bellbottoms needs to happen after this deformation. The best way to do this is with an object-oriented animation system. A package such as Maya, Max, or Houdini would fit the bill. The software would deform the pants mesh, and the morph is then applied after the deformation, either to the entire pant mesh or to just those vertices close to the bottom.
You can also approach the same problem with clusters. A cluster is simply a group of vertices that can be controlled through one set of keyframes. You could then animate the bottom of the pants forward and back. However, this will not be as convincing because little details such as folds and creases of the fabric are difficult to achieve.
In the end, I would like to thank you for the support that you have shown by reading this article, for more articles please keep visiting...