Search form

'Maya Plugin Power': Cloth Simulation and Modeling

In the first excerpt from Maya Plugin Power, author Mark Jennings Smith shows how to get started simulating cloth in Maya using plugin Syflex.

All images from Maya Plugin Power © Course Technology.

This month, VFXWorld begins a series of six excerpts of the Course Technology PTR book Maya Plugin Power, which will give VFXWorld readers to learn how to take advantage of the myriad of plugins available to Maya users.

For my money the best way to get cloth animation from Maya is the cloth simulation plugin Syflex. It has great advantages over Autodesk nCloth. It is flexible and easy to use and is very useful for other softbody simulations. Here is an easy way to make a skirt in Syflex.

A Simple Garment

This chapter would not be complete without an example of an article of clothing. Creating virtual cloth and clothing is usually a complex matter, but Syflex makes creating clothing a simple task. By hiding the user from complex algorithms and math, Syflex allows an artist to spend more time being creative.

Let’s take a short look at creating a spinning skirt. Load the scene pleated_skirt.mb, which is located on the companion DVD. The simple pleated skirt model in Figure 1 has a blinn shader for catching the light as we begin to spin the skirt.

Let’s start by selecting the pleated_skirt node. We need more polygons in this object to get a smooth cloth skirt. Under the Modeling menu, select Edit Polygons > Subdivide with two subdivision levels. Figure 2 shows the new subdivided geometry and the proper settings for the subdivide.

[Figure 1] Polygon skirt object and render with blinn shader for highlights. 

[Figure 2] Polygon skirt subdivided with two subdivision levels using quads.

The skirt is now better subdivided for cloth animation. With the pleated_skirt node selected, we must go through the workflow to change it to a cloth object that can be subjected to forces. This workflow is consistent with everything we have discussed in prior tutorials.

  • 1. Select Syflex > Cloth > Create Cloth and change the name of the resulting syCloth1ShapeTrf to sySkirt_ShapeTrf and syCloth1Trs to sySkirt_Trs.

2. Next, select the sySkirt_Trs.node and select Syflex > Forces > Create Gravity. Running the simulation now makes it obvious that we must keep part of the skirt from moving under gravity, while the rest is free to dangle.

3. Select the syCloth1ShapeTrf node and choose the top row of vertices, as shown in Figure 3.

[Figure 3] Top row of vertices selected for conversion to a Nail Constraint.

  • 4. Select Syflex > Constraints > Nail. This acts as the waist. The syNail1Trs node can be animated. It is the basis for our spinning and swirling skirt motion.Save your work.

5. Load the scene dancing_skirt.mb, which is located on the companion DVD. This scene has the syNail1Trs node animated over 300 frames. The animated hip translation and rotation gives the skirt a nice dynamic dancing quality.

6. Run the simulation. The animated hip gyration gives the cloth quite a ride, but as shown in Figure 4, the cloth does a nice job of keeping up with the motion.

A bit of maintenance is needed for the cloth to act more realistically. Figure 5 shows the cloth spinning in on itself, causing severe intersecting geometry, and the polygons are visible in the final render. The skirt could be further subdivided or polygons could be smoothed, but the geometry can also be replaced with something more render-friendly and flexible.

[Figure 4] Frame 220 of the test simulation.

Rewind the Timeslider to the beginning frame. We are going to use a relatively low-polygon animated skirt as a proxy that will drive a more realistic subdivision surface model.

  • 1. With the syCloth1ShapeTrf mesh node highlighted, create a subdiv surface duplicate, making sure to keep the original selected, as shown in Figure 6.

2. With the polygon skirt selected, go to the top of the Maya menus and select Modify > Convert > NURBS to Subdiv to create the subdivision surface duplicate of the skirt.

This subdiv duplicate is driven by the original low-polygon cloth animation with a wrap deformer. Maya has several types of deformers to choose from. Deformers give you the ability to smoothly contort or deform geometry in a variety of ways. Deformers serve many purposes and are infinitely useful in creating animation that might otherwise be impossible by other means.

  • 1. This can be done by selecting the new polyToSubd1 node and then the syCloth1ShapeTrf node. The order is important.

2. Amidst the Maya menus in the Animation menu set, select Create Deformers > Wrap. The subdiv surface model is now deformed by the cloth.

3. We must now hide the syCloth1ShapeTrf node by making it invisible. Select syCloth1ShapeTrf in the outliner and turn off visibility as shown in Figure 7. What remains is the subdiv copy of the skirt ready to render (see Figure 8).

mayap105_fig2-37.gifmayap106_MayaPluginPower-fig2-38.gif

[Figure 5] Polygons visible in a mental ray render.
[Figure 6] Creating a subdiv duplicate of the polygon mesh skirt.

mayap107_MayaPluginPower-fig2-39.gifmayap108_MayaPluginPower-fig2-40.gif

[Figure 7] Polygon mesh skirt hidden from view. 
[Figure 8] The subdiv render creates a much smoother look. 

Only one more tweak must be made for our skirt to be a dancing success. The intersecting geometry shown in Figure 5 must still be fixed. This can be done by selecting the syCloth1Trs node and setting the Self Envelope attribute to a value of 1, as shown in Figure 9. When rendered out now, the intersecting geometry is gone. Figure 10 shows the effects of Self Envelope having a value of 1. (The final scene file is located on the companion DVD in the Chapter 2 folder.)

mayap109_MayaPluginPower-fig2-41.gifmayap110_MayaPluginPower-fig2-42.gif

[Figure 9] The Self Envelope value on syCloth1Trs set to 1.
[Figure 10] Identical frames rendered without Self Envelope (left) and with a value of 1 (right).

In this chapter, we learned the power of Syflex for doing cloth simulation and how versatile it is at creating other materials, such as rubber. More information on Syflex can be found in the appendix under Chapter 2. This includes links and other resources including bonus scene files not worked on in this chapter.

Mark Jennings Smith is a seasoned artist, animator and writer residing in Beverly Hills, CA. Smith has been fascinated by CG since 1972, when at age 10 a chance encounter with the first coin-op Pong changed his life. His interest in the entertainment field led Smith and a partner to establish Digital Drama in 1994, which focused on computer-generated imagery, animation, digital painting and special digital visual effects. Digital Drama designed the digital film effects and animation for companies such as Universal Pictures, Trimark Pictures, Fox Home Ent., HBO and Showtime. Smith has contributed to several books and magazines, including a chapter in Maya: Secrets of the Pros. He also created cover art for the book and a variety of other titles in the 3D arena. He served as the technical editor for Mastering Maya Complete 2 as well as consulted and beta-tested dozens of software packages. Smith has also taught visual effects and computer animation using Maya at New York University.

randomness