Workshop 12: Cloth and Constraints

May 15 2023 Workshop 12 Notes

CLOTH AND CONSTRAINTS

  1. We begin by creating a cloth surface from a polygon and animating it. We will then vary some of the constraints cloth that will impact how it moves. Note that we use polygons for generating cloth objects in this workshop. Note also that the instructions are related to Maya 2020 although some of the animations below were generated from an earlier version of the software
  2. Create two arcs in order to make the first cloth.
  3. In the modeling module, use the loft tool to generate a polygonal mesh between arcs. Note the loft tool allows for the specification of a polygon rather than nurb object.   Set section spans to 6 in the loft dialog box.
  4. Now, working from the front view and then in the perspective view window, create a cylinder from the polygons shelf tool.
  5. Go to the FX module , select the cylinder, and choose nCloth/Create Passive Collider.
  6. Select the lofted polygonal mesh, and choose nCloth/Create nCloth, using the default options.
  7. Create 200 frames and play the animation. The results should approximate the following movie (select image to load movie).
  8. Lets add some constraints to the cloth, such that it is pinned along a line. Using the “Select by Components” mode, and select the cloth. Next used the selection tool and the shift key from the front view to select a linear alignment of control vertices.
  9. Select menu item “nConstraint/Transform Constraint”and Apply.
  10. Go back to the 1st frame, and play the animation. See how the movement of the cloth is now constrained by the line as if it was a clothing line.
  11. Go to “Fields/Solvers” menu, and select the item “Air” along with it’s checkbox. In the dialog box that follows, name the windfield air1″. Set direction  to X = 1, and Y = 1. Set attenuation to 0. Leave magnitude at 4. Select the cloth and then select the “apply” button.
  12. Go back to the first frame, and try playing animation. Note that the cloth is barely impacted by the wind.
  13. Now select the wind field, and set its attribute for “magnitude” to 40. Replay the animation.
  14. Go to the air attribute editor, right-click on magnitude and enter the following expression (the name “air1” was used in this example to create this wind field):
    air11.magnitude = sin(deg_to_rad(frame * 10)) * 50;
  15. Go back to frame 1 and replay the animation. Note the oscillation pattern due to the wind magnitude oscillation.
  16. Create a 12 x 12 polygon mesh, convert to nCloth, and constrain it to a multiple vertices on a 1 degree curve (a segmented line) at some arbitrary height above the x-z plane, similar to how this was done with the preceding cloth.
  17. In object mode, select one line of newly constained vertices on the cloth such that you are able to see dynamic constraints (e.g., dynamicConstraintShape2) appear in the channels box. Change over to the Attributes Editor
  18. In the Attributes Editor, note that the there is a check-box adjacent to the word “Enable”. To get to the expression editor, you are unable to Right-click directly on the word “Enable”; however, you can right-click on the attribute “Constraint Method” just below it, and open the expression editor. Once you’ve entered the expression editor, use the object and attribute “dynamicConstraintShape2.enable”
  19. The last step opens the expression editor. In the Attributes scroll area select the “enable” attribute. Consquently, the text “dynamicConstraintShape2.enable” is automatically placed in the text box “Selected Object and Attribute”
  20. Now go to the expression creation text area and enter the following MEL code:if (frame < 50) {
    dynamicConstraintShape2.enable = on;
    }
    else
    {
    dynamicConstraintShape2.enable = off;
    }
  21. Play back the animation and note the temporary constraint placed on the cloth, which causes it to fold, before dropping and colliding with the second cloth.
  22. In a new scene file, create a 12 x 12 divided polygon surface  and place it above the ground . Make  the polygon surface into a nCloth object. Create a cylinder polygon with 12  “height”  subdivisions and make in a passive nCloth object. Play an animation of 200 frames and observe the behavior.
  23. Next, right-click on the 12×12 flat polygon surface. Choose “vertex” and select the middle vertices of the polygon surface as indicated in the image below. Shift-select the cylinder. Select the menu item “nConstraint/Slide on Surface”.
  24. Play back the animation and observe the result.
  25. The shape of the cylinder is reflected in the cloth as it slides along it at a constrained distance.
  26. Go to the attribute editor for the cylinder’s y rotate value, open the expression editor, and enter “pCylinder1.rotateY = frame * 5;” (use the name of the cylinder if it is not pCylinder1.rotatey.
  27. Play back the animation and observe the result.
  28. Create a polygonal 12 x 12 mesh, convert to nCloth, and placeit  alongside the existing polygon such that the edges touch as shown in the image below. Under the nConstraint menu choose “Weld Adjacent Borders”.
  29. Play the animation and see the result.
  30. Finally, select the first  12 x 12 polygon, and under nConstraint, select “Make Tearable Surface” along with the checkbox to open up the dialog box. Select on the “Use Sets” option and then select the cloth surface direcly above the cylinder and then select the Apply Button.dialog
  31. Note that the cylinders collision with the “tearable” surface will tear it into fragments during the animation sequence.animated tearable surface
  32. Play back animation.  The strength of this surface is adjustable under the attributes editor.playblast of surface