|
Feedback
Posted: Apr 06, 2007
Category: nCloth
Here is how to do the "fun and the best of the toys" using Maya nCloth.(Sing Along)
The slinky is a special type of near zero tension spring. It is constructed with a flat ribbon of metal that resists shear and bend in the ribbon plane but easily bends down the axis of the spring. We can simulate it with nCloth by constructing a long spiral cloth ribbon and giving it similar properties. 1. Model the slinky We can model the slinky using one of my favorite tricks, which involves creating a spiral using only a 2 cv curve on a nurbs cylinder. a) MENU "Create: Nurbs Primitives: Cylinder" b) MENU "Modify: Make Live" c) MENU "Create: Cv Curve Tool" In the options set curve degree to 1. Then add a cv to the top and bottom edges of the cylinder and hit enter to create a 2 cv curve on surface. Now comes the fun part.
d) Create the spiral. Select the two curve cvs and edit their values in the channel box. The Y attribute will determine the number of coils. Set one to zero and the other to 300. The curve on surface display will look crude, but don't worry as the actual curve is precise.
e) Select the curve and do MENU "Surfaces:Edit Curves: Duplicate Surface Curves". Then repeat so you now have two 3d curves.
f) Scale up the second duplicated curve in X and Z (1.2, 1.0, 1.2) One can scale in x an z only by dragging the Y (yellow) scale box while holding the control key.
g) Select the two duplicated curves and do MENU "Surfaces: Loft"
You now have the basic slinky shape, but nCloth needs a poly mesh, not a nurbs surface.
h) MENU "Modify: Convert: Nurbs to Polygons"
Initially we have way too many polygons. It is critical that we triangulate the nurbs to get the most efficient mesh for simulation. On the created nurbsTessellate node set the following: Enable Advanced Tessellation = ON PolygonType = Quads Format = General General Tessllation Options: UV Type = Per Surf # of Isoparms in 3D U Number = 414 V Number = 1
i) Hide the nodes "nurbsCylinderShape1" and "loftedSurfaceShape1", as they are now really upstream construction history. If desired instead of setting visibility you may wish to set "Intermediate Object" to true, which indicates more that they are used as construction history. You may also wish to either hide the nurbs curves or turn off curve display.
The basic slinky model is now complete.
2. (optional) Apply a bend deformer to the slinky: MENU "CreateDeformers: Nonlinear: Bend" (You can use the deformer to pose the start shape of the slinky, however it will not be used in this tutorial) 3. Select the slinky ("nurbsToPoly1") and do MENU: "nCloth: Create nCloth". Enable "Use Plane" on the nucleus node for ground collisions, move the slinky above the ground plane and playback. At this point it looks more like a cloth slinky than a metal one and has some self collision problems as well.
4. Adjust the selfCollisions settings. On the nCloth node set solver display to selfCollision to preview the collide width. The values that were picked when the cloth was created are pretty good so the thickness can be left at 0.028, although the following needs to be set to keep the borders from interpenetrating:
selfCollisionFlag = "Full Surface"
5. Make the slinky much stiffer. First off we will need more than the max iterations settings on the nCloth, so lets just set it to a very high value ( do not confuse this with the self collide iterations )
Max Iterations = 10000 Then we can set the stiffness related attributes high. In particular shear resistance is helpful because the stretch crosslinks cannot stiffen the skinny quads as much as we would like. (normally shear resistance is not needed because the more efficient stretch/compression cross links keep quads from shearing) Bend affect how much the slinky pulls apart, and doesn't need to be as high because the metal ribbons can bend much more along the flat side. Stretch Resistance = 3000 Compression Resistance = 3000 Shear Resistance = 1000 Bend Resistance = 500 Also we increase the mass so that air drag has an insignificant effect. Mass = 10 6. Set the general scene scale and collision quality. The slinky is now stiffer but still has collision problems when we playback. On the nucleus node change the following: Substeps = 20 (For the finished animation you may wish to bump this to 100 or more to avoid self collision problems, but 20 was enough to create the avi in this demo) SpaceScale = 0.4 Initially the slinky was 2 meters wide in term of dynamics, the space scale of 0.4 makes this .8 meters wide, which is still a very large slinky. However the net result is that gravity is not quite so strong and things move a bit in slow motion. If you really want to simulate at full slinky speed(small things move fast) then make this lower and increase the stiffness attributes as well as the substeps. 7. Create the passive scene geometry. In this example we wanted some stairs. This can be quickly created by setting the subdivisions on a plane and moving cvs in a side ortho view. Although any method should work fine. Just make sure that the normals face outward( towards the slinky.. if you collide with both sides then turn off trapped check on the nRigid ) and that the poly count is not excessively high. The steps should be just a little wider than the slinky. When done select the geometry and do "nCloth: Create Passive".
8. Start the slinky at the top of the stairs. I initially had a tricky time trying to get the slinky started. I found a simple trick is to create a cylinder, make it a passive object and then rotate the slinky 90 degrees and drop on the cylinder to get it to start in the desired shape. Or you could try using the bend deformer described in step 2.
At this point you should be able to run and get the desired playback. You may wish to also increase the friction on the stairs and the ground for better contact as the slinky moves.
9. Cache out the finished simulation: MENU "nCache:Create New Cache"
10. Smooth and thicken the slinky for rendering. First smooth the slinky: MENU "Mesh: Smooth". On the polySmoothFace node turn OFF "Keep Geometry Borders". Now thicken it: MENU "Edit Mesh: Extrude". On the polyExtrudeFace node turn ON "Keep Faces Together" and set the "Local Translate" to 0 0 0.028. (this is the nCloth thickness). Note that everything done to this point has history, so you can go back and change the total number of coils by editing the curve cv position, or deform the shape of the original nurbs cylinder, etc. Of course this will require re-caching the simulation.
11. Shade and render For this example I used Mental Ray raytracing with soft reflections on the slinky combined with spotlights with soft raytrace shadows. One could increase the shadow rays count on the spotlights to reduce the dotty quality of the lighting if desired. Also I raised the motion blur "time constrast" to speed up the render. If you want smoother motion blur lower this value.
| |||||