A very simple nCloth flag

By -
4 mins
Last modification: 16 Sep, 2017

Here is a very basic workflow for creating a flag using the new nCloth in Maya8.5. 1. Create a poly plane. Scale and position it to the desired start location and set the subidivsions on the polyPlane node to the desired resolution. 2. MENU "nCloth:Create nCloth" 3. Select two corner vertices on the plane 4. MENU "nConstraint:Transform" You can now playback to see the flag drop. One can keyframe the transform on the constraint to pull the flag around. One may wish to parent this constraint to a flag pole object. One could then wave the flag by animating the transformation of the pole. 5. On the nucleus node edit the windSpeed and direction attributes to blow the flag. You may wish to have a windspeed greater than 1 depending on your object scale. It is also a good idea to lower the mass on the nCloth node so it is more responsive to the wind. (increasing the drag/lift or air density would have similar effects but mass is more logical in this instance) You should now have a flag flapping in the wind:

6. Set the relative scale for dynamics You can set the relative size of the flag (in terms of gravity and wind speed ) by adjusting the spaceScale attribute on the nucleus node. Dynamics in Maya assume that units are meters and ignore the actual Maya units setting. If you modelled the flag with the assumption that units were centimeters, for example, then set the space scale to 0.01. The primary effect of this is an increase in gravity. 7. Adjust cloth stretch resistance For a detailed mesh the default settings will likely be too stretchy. You can increase the stretch resistance to 200 or so. Note that the strength on the constraint should also be increased to avoid stretching of edges near the constraint. Also if you set the scalingRelation to "local" the various effects like stretch and bend resistance will be automatically adjusted to compensate for the mesh density, which is useful when you want to model the stretch behavior on low resolution stand-in objects. 8. MENU "Mesh:Smooth" This is optional, but very useful. With a quad mesh one gets a very good quality surface with the smoothing. This is also much more efficient than simulating on the higher resolution mesh. After the mesh smooth:

9. Changing which vertices are constrained At any point you can easily change the vertices of the flag that are constrained by simply selecting new vertices on the flag and doing: MENU "nConstraint:Replace Members". For example if you had edited the mesh resolution since creating the constraint you may need to redefine the vertices. Note that if you had done a smooth on the mesh then you should temporarily make the subdivision levels = 0 on the polySmoothFace node so that only the simulating cvs are selectable for the replace members operation. Alternately you could do MENU "Display Input Mesh" and select cvs on the input cloth mesh instead of the smoothed mesh, then do MENU "Display Current Mesh" when done. 10. MENU "Edit nCloth: Initial State: Relax initial state" This will allow your flag to be in a natural pose at the start of the simulation. Temporarily make the wind speed zero before doing this if you want it to be fully collapsed at the start. 11. MENU "Cache: Create New Cache" This will allow you to playback at full speed as well as scrub the animation. It is also generally a good idea to cache before rendering. That's all there is to it. However there are additional techniques that help for a more advanced flag animation which I will cover in a coming post.

Posted By
Published In
  • nCloth
To post a comment please login or register
| 11 years ago
Hi Duncan. I was wondering if there is a way to do a seamless cycle in nCloth? I'm going to animate an fabric that goes on in an seamless and endless loop. Thanks /anders ps, thanks for a great blog!!
| 11 years ago
Hi , I was making a flag myself but i got stuck in looping the animation, I made a flag ( simular to this one) and set its initial shape and cached the animation (200 frames). Does anyone have a tip on how to make the first and the last frame identical ... So the animation can loop over and over... Thx
| 12 years ago
Hi Duncan, Do you have any tips and/or tricks for looping nCloth simulations? I'm guessing there is a way to do it with blending cache files. Thanks for all of your great info on this blog. Paul
| 12 years ago
is it that so simple?!!!! thank U Duncan, i was lost trying 2 start using nCloth - BUT NOT ANYMORE thankx again
Hi Duncan, Thanks so much for responding with your insightful tips. I was wondering about stretch resistance & compression resistance; do they have a linear relationship to the scale? Should we just multiply a the default resistance of 20(stretch) by 100 for centimeter scale? 2000 seems quite high as a number, but intuitively, this is how I would approach it. Does this also apply to constraint strength? Best, Jacques
| 12 years ago
For real world gravity, especially with very small objects, you will need a great deal of stretch and compression resistance. As well it helps to have high constraint strength and high simulation substeps. Basically one can think of the world at small scale as a fast motion version of the larger world. As such it requires more iterations in general to solve the dynamics. The lower gravity can look nice( like either a very large or slow motion flag) but if you want realism then go for the 0.01 space scale and increase stretch resistance, constraint strength( to avoid stretching near the constraint), and substeps( avoids stretching where colliding ).
Hi Duncan, Thanks for this tutorial on an nCloth flag. I have found that although the model I created was created at centimeter scale (settings>workingUnits>linear>centimeters) and the object that I created was scaled to reflect the real world size in centimeters, the space scale reacts quite intensely at a setting of 0.01. From a playblast of 1, 0.1 and 0.01, I have found that 0.1 seems to 'look' better right off the bat, especially when collidin with an object. Whereas 0.01 seems to have an extremely high amount of gravity, and tears/or stretches a lot around the collision object. What settings are good to troubleshoot if one wants to use a space scale of 0.01 (centimeter). Best, Jacques
*Save $66 per month on Autodesk's Suggested Retail Price (SRP) when purchasing 1 year term 3ds Max or Maya subscription.