Falling leaves with nCloth and Paint Effects
-Use latest simulation module nCloth and Paint Effects in Maya 8.5 to create falling leaves animation
Author: Duncan Brinsmead
Source: Autodesk Area
sunsetLeafFall.avi sunsetLeaf.zip With nCloth, Maya users finally have a simple method for handling falling leaves. One can also easily attach leaves to branches and have the attachments broken by windforces by using nCloth constraints with glue strength. The basic workflow is very simple. Make a paint effects tree, convert it to poly, select the leaves and make nCloth. What follows is a more detailed tutorial.
1. Create a Paint Effects Tree
In general it helps to use a tree that will convert to poly well and which will not have too many segments per leaf. Here is a brush preset that should work OK. Put the following two files in your maya location "treesMesh" directory. (Do "Paint effects:Get Brush" and you will see the full pathname near the top left of the visor window) oakBigLeaf.mel oakBigLeaf.mel.icon You should now be able to select the preset "oakBigLeaf" in the visor and then create a tree by painting on the ground.
2. MENU "Modify: Convert: Paint Effects to Polygons"
3. Select the Leaves
4. MENU "nCloth: Create nCloth"
The leaves will now fall downward during playback. On the nucleus node turn on "Use Plane" to collide with the ground. The playback will be rather slow. To speed things up set the substeps and max collision iterations on the nucleus node to 1. Also turn off "Self Collide" on the nClothShape. (If you want to collide the leaves with each other you can enable this, but you will likely wish to make the selfCollideWidthScale 1.0 and lower the thickness a bit) The simulation should now playback quickly. Raise the friction on the nCloth and the planeFriction on the nucleus node so the leaves don't slide too much.
5. Increase the nCloth bend resistance
The preset in this tutorial has a little bend on the leaves so that they will curl as they fall, in typical leaf fashion. We need some bend stiffness for this to work. The Stretch/Compression/Bend resistance can all be set to 1.0 (if you have more segments on the leaves then you will need higher values)
6. Increase Lift and Drag on the nCloth
Setting both attributes to 0.3 works pretty well. In general if you make the lift higher than the drag it will be too energetic, but it provides a nice control over the character of motion. You can also make the tangential drag a little higher than zero so that there is some resistance to motion in the plane of the leaf. With tangentialDrag at 1 and lift at 0 we have simple uniform drag which looks boring and unnatural: sunsetLeafUniformDrag.avi If we lower the tangentialDrag to 0 but still have zero lift the effect is somewhat more interesting, but you still don't get the desired looping motion: sunsetLeafNoLift.avi When we add in the effect of lift the animation becomes much more natural: sunsetLeafFall.avi
7. Have some fun!
We can play with various cloth attributes during playback to see how it affects the simulation. Try editing the wind strength and direction on the nucleus node to blow the leaves around. You can pull all the leaves back onto the tree by raising "Input Mesh Attract". Note that if one animates the original pfx tree( with turbulence for example) then this attraction is to the animated leaf positions. One could have the tree blowing around using turbulence on the pfx brush node then animate the inputMeshAttract from 1 to zero to release the leaves. Raising deform Resistance will freeze the overall group of leaves as if they were in a block of ice. Lowering it will then "melt" the ice (not realistic, but still fun). The rest of this tutorial will cover how to attach the leaves to the tree and dynamically break the attachments(through wind or tree shaking) such that the leaves don't all fall at once.
8. Select the leaves and the tree
9. MENU: "nConstraint: Component to Component"
By default each cv on the leaf object is connected to the nearest cv on the tree object, and visa versa. Instead we only want connections where the leaves touch the tree. To do this set the constraint "Connection Method" to "Within Max Distance" Now when you playback some leaves will fall, because all their cvs are further the the default "0.1" Max Distance from the tree cvs. We can simply increase the Max Distance to about 0.3. Playback will now be slower because this creates many connections( some redundant ones ). The longer connections can help keep the leaves from twisting about the branch. A more accurate connection would involve connecting edges to edges and using the bendStrength on the constraint to keep the leaves from twisting, although this is much slower to compute. To do this lower the constraint max distance to about 0.08 and on the two nComponent nodes set "Component Type" to edge.
10. Set glue strength so bonds can break.
Set the constraint glue strength to about 0.2 and increase the wind speed on the nucleus node to blow leaves off the tree. Note that one may wish to type values greater than 1.0 into the wind speed. Alternately you could have turbulence animation on the oakBigLeaf brush to shake the leaves off. One could also key the brush Uniform Force attribute to bend the tree. Note that if you are using an edge to edge constraint with bend strength then you also need to set the constraint "Bend Break Angle".
In the following animation the brush Path Follow attribute was animated to bend the tree, following by an increase in Wind Speed on the nucleus node.
sunsetLeafBlow.avi The following project contains the scenes sunsetLeafFall.ma and sunsetLeafBlow.ma as well as source image files. sunsetLeaf.zip