Understanding and Creating nCloth Simulations in Maya

Creating believable cloth simulations has always been a challenging task in the 3D world. With Maya's nCloth you're able to create a convincing cloth simulation with any polygon mesh in a very short amount of time. This article will cover the fundamentals of nCloth, the things you need to know and how to set up some basic nCloth simulations so you can use this powerful feature more comfortably in your next CG project.

What is nCloth?

nCloth is a very fast dynamic cloth simulation that uses a proprietary simulation engine called Nucleus to simulate a wide range of polygon surfaces. You're able to model any mesh and make it an nCloth object. Despite it's name, nCloth isn't only for simulating clothing. You can use it for things like water balloons or shattering surfaces. It's robust attribute system which allows for a great deal of customization. It's important to keep in mind nCloth only works with polygon meshes, so you can't use something like NURBS or a subdivision surface. You also want to try and maintain quads for your geometry, just to ensure the calculations are correct during simulation time and that there are no deformation issues which can occur with triangles or ngons. nCloth works by a connection of many different particles to what are called links. These create the dynamic mesh. When you make a polygon mesh an nCloth the links are automatically added to the object. These components directly correspond to the original mesh, so for each vertex position there is a particle and for each edge there is a link.

Key nCloth Properties

The nCloth object properties determine the physical characteristics of the cloth. These properties affect how the cloth interacts with other objects and how it behaves. The nCloth properties are found in the Attribute Editor of the nCloth shape node. While there are many different settings within each property, as long as you know the affects they have on your nCloth you can experiment with these settings to get the desired result. The Collision attributes are pretty self explanatory; they determine the characteristics of your nCloth when it collides with other objects. The settings here can help you to establish things like friction to control your cloth object sliding off or clinging to another object with they collide with it. Collision The Dynamic properties determine the behavior of your nCloth object when interacting with other objects, or being animated. You can set if the cloth crumples or bounces like a water balloon or how much it should deform when impacted by another object. Dynamic Another important property to keep in mind is the Gravity and Wind attributes which are located in the nucleus node of your nCloth object. These settings help to determine the types of effects wind speed and direction has on your nCloth. These are especially important for creating something like a flag blowing in the wind. Gravity

Setting up a Basic nCloth Simulation

This quick tutorial will walk you through the process of setting up a very simple nCloth simulation. Instead of creating something like a table cloth we'll look at how to create a very simple water balloon type simulation to demonstrate how versatile nCloth can be. With a new scene in Maya setup go to Create>Polygon Primitives>Platonic Solids. Instead of using the default sphere you'll be creating your own sphere to try and avoid the poles that occur on a default polygon sphere. Screen1 Now that you have the new Platonic Solid mesh created, select it and go to your channel box and open up the polyPlatonicSolid1 input node and change the Solid Type to Icosahedron. Screen2 With your object still selected make sure you're under the Polygons menu set and go to Mesh>Smooth. Apply the smooth operation two times. Since simulations always work best with quads, this'll technique of creating a sphere full of quads will help you ensure you get clean deformation results. Screen3v2 Translate your sphere up in space and create a new plane beneath it, resizing it enough to create a floor for the sphere to collide with. Screen4 Select your sphere and change your menu set to nDynamics and go to nMesh>Create nCloth. This will change the sphere you created into a new nCloth object. Screen5 Now change the number of frames on your timeline to something like 1000 frames so you'll have enough frames for your simulation to be played out in. If you click the play button you'll notice the sphere will start to fall, but it falls straight through the ground plane! That's because we haven't made the polygon plane into a collidable object yet. Screen6 To make your sphere collide with the floor select the ground plane and go to nMesh>Create Passive Collider. Screen7v2 Play the animation out and now your sphere should collide with the ground. Although the sphere crumples into itself so now you'll need to do some adjustments in the nCloth attributes. If you want you can put the plane on a new layer and hide it so you can just see the sphere. Screen8 Select your sphere and go into the attributes of the nClothShape1, here you can adjust the properties to have your nCloth behave closer to how you want it. Screen9 Scroll down to the Dynamic properties and adjust the rigidity to somewhere around 0.150. This'll allow the sphere to hold its shape while still deforming closer to a water balloon. Screen10 You'll also want to dial down the Stretch Resistance to somewhere around 5.5. This will allow the sphere to stretch more on impact. Screen11 Now go up to the Collisions properties and change the Bounce to around 0.100. Screen12 After you've adjusted the bounce you can add a few more smooth operations on your sphere to ensure the deformations are clean. In just a few minutes you've converted a basic sphere into an nCloth object and created a pretty good looking balloon simulation! This is just scratching the surface of the possibilities of nCloth. You can adjust the different attributes to experiment with the types of changes it has on your simulation.

Tips for Working with nCloth

When editing the nCloth simulation it's good to work with a low resolution mesh. As you're probably aware the higher resolution your mesh is the more taxing it will be on your computer and it takes even more processing power to run a simulation on a high resolution mesh. Once you're happy with your simulation you can run a smooth operation. That way you can keep your system running smoothly while you're testing and editing the simulation. If a region of the cloth needs to be stiff you can connect the vertices in the region and apply a point constraint. This is important for working with a flag or banner needing to stay attached to something. You can do this very easily by selecting the vertices you want to stay pinned to the object and go to nConstraint>Transform. This creates a locator between the middle of the vertices. Now your flag will stay in place as you play out the simulation. Constraint As mentioned earlier working with simulations can be taxing on your system, a good way to improve the playback speed is to lower the Substeps and Max Collide Iterations of the nucleus node.  This of course will mean a lower quality when played back, but once you have your simulation looking how you want you can increase these values again. Substeps nCloth is an extremely powerful cloth engine you should be learning as a Maya user. As you found out in the quick tutorial nCloth has the flexibility to be used to simulate different types of objects other than cloth. For instance, it can be great for simulating lava or concrete being poured. To learn more about the powerful nCloth engine check out Introduction to Maya nCloth.