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:

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:

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.
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!!
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
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
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



