Lesson 4: Simulating the low resolution shirt

 
 
 

In this lesson, you simulate the character’s shirt using the workflow described in Lesson 3. Although there are some variations in attributes and values, the principles are the same.

In this lesson you will:

Lesson Setup

To ensure the lesson works as described, do these steps before beginning:

  1. If you have not already done so, download the nCloth Advanced Techniques Lesson Data from the following location: http://www.autodesk.com/maya-advancedtechniques. Then, set the nClothAdvancedTutorials directory as your Maya project.

    For this lesson, you need to access Maya geometry cache files in addition to the lesson scene file.

  2. Open the scene file named Character_LowRes_4.mb.

    This file can be found in the nClothAdvancedTutorials directory that you set as your Maya project.

  3. Import the geometry caches which animate the character’s body and shoes. See Importing geometry caches.
  4. To speed up the simulation of the nCloth shirt, either create a new cache for the nCloth pants, or use the pants nCache from the previous lesson.

    To create a new nCache, using the nDynamics menu set, in the Outliner select nCloth_Pants, and select nCache > Create New Cache.

    To use the nCloth pants nCache from the previous lesson, you may need to reconnect the cache to the nCloth object. See Reconnecting objects to existing caches.

If you use a Maya scene file from a previous lesson, ensure that you:

Converting the shirt to nCloth

To convert the shirt to nCloth

  1. Select the nDynamics menu set.
  2. Show the Shirt_LowRes object by selecting it in the Outliner, and then selecting Display > Show > Show Selection.
  3. Select the low resolution shirt object (Shirt_LowRes) and select nMesh > Create nCloth > .

    The Create nCloth Options window appears.

  4. From the Solver drop down list, ensure nucleus1 is selected.
  5. Click Create Cloth.

    The low resolution shirt is converted to an nCloth object, and is added to the existing Maya Nucleus solver.

  6. To ensure that the low resolution nCloth shirt is easy to identify in your scene, rename it. To do this, in the Outliner, double-click nCloth1, type nCloth_Shirt, then press Enter.
  7. Cache the nCloth shirt simulation by selecting nCloth_Shirt in the Outliner and selecting nCache > Create New Cache.
  8. Play back the simulation.

Applying an nCloth preset to the shirt

When you play back the simulation, you notice the following:

  • Around frame 1033, the shirt collar is stretching too much to resemble the fabric it's trying to emulate.
  • At frame 1033, some of the shirt’s vertices are self trapped within the object, and interpenetrations between the shirt and pants appear around the character’s waist. This is caused by inaccurate collisions between the nCloth shirt and nCloth pants objects.
  • At frame 1037, the polygon faces in the front of the shirt are deforming poorly.
  • Between frames 1040 and 1045, some of the shirt’s vertices are trapped by the nCloth pants, and there are interpenetrations.

A useful way to solve a number of these simulation problems simultaneously is to apply an nCloth attribute preset to the nCloth shirt object.

To apply an nCloth preset to the shirt

  1. In the scene view, select the nCloth shirt.
  2. In the Attribute Editor, select the nCloth_ShirtShape tab.
  3. Click-hold the Presets button.
  4. Select the tshirt preset, and then Replace (tshirt > Replace).

Some important attribute adjustments made by the t-shirt preset are the following:

  • Stretch Resistance is adjusted from 20 to 35.
  • Bend Angle Dropoff is adjusted from 0 to 0.4.

    Bend Angle Dropoff adds resistance to bending forces by responding to the angle and strength of the force applied to the nCloth. For example, a high Bend Angle Dropoff causes an nCloth to resist bending at higher angles more than at lower angles. When you simulate the shirt, you will see Bend Angle Dropoff reducing the nCloth's tendency to bend when it is beginning to bundle up at frame 1032.

  • Mass is adjusted from 1.0 to 0.6.

    The reduction in Mass reflects the light to medium weight material of a cotton t-shirt.

  • Damp is adjusted from 0.0 to 0.8.

Cache the simulation by selecting the nCloth shirt and selecting nCache > Replace Cache and then play it back to observe the results.

Wrapping the high resolution mesh

In this section of the lesson, you use a wrap deformer to create an influence object for the high resolution shirt.

To wrap the high resolution mesh

  1. Show the Shirt_HighRes object by selecting it in the Outliner, and then selecting Display > Show > Show Selection.
  2. In the scene view, Shift-select the nCloth shirt object.

    Both the Shirt_LowRes and the Shirt_HighRes should now be selected.

  3. From the Animation menu set, select Create Deformers > Wrap> .
  4. In the Create Wrap Options window, turn on Exclusive bind.
  5. Click Create.

    A wrap node appears in the Attribute Editor, and a Shirt_LowResBase object appears in the Outliner.

  6. Hide the Shirt_HighRes object.

Identifying problem areas in the simulated nCloth

When you play back the simulation, you notice the following:

  • At frame 1032, the excessive stretching around the shirt's collar is reduced. However, this area of the nCloth is still stretching too much.
  • At frame 1033, in the waist area, some previous instances of self trapped vertices have been resolved, however some interpenetrations still remain.

The nCloth t-shirt preset has improved many of the simulation issues, however some Dynamic Properties attributes need further adjustment.

When editing the Dynamic Properties attributes, cache your simulation and then play it back between attribute adjustments to see how your new settings affect the nCloth shirt's behavior. For comparison purposes, you can also display the reference character in the scene. To do this, in the Display Layer editor, turn on Visible.

To edit the shirt's Dynamic Properties

  1. In the Attribute Editor, click the nCloth_ShirtShape tab.
  2. In the Dynamic Properties section, make the following settings:
    • Stretch Resistance: 55
    • Compression Resistance: 3
    • Bend Resistance: 0.3
  3. Cache your simulation, and play it back.

Editing the Quality Settings and resolving interpenetrations

When you play back the simulation, you notice the following:

  • Between frames 1028 and 1034, around the character's waist, there are areas where the pants and shirt no longer overlap. Also, at the character's back there is still some of the shirt's vertices trapped by the pants.

    The offset between the nCloth object occurs because the collision Thickness is currently set to accommodate the high resolution wrap deformer. Reducing Thickness may solve this issue, but be aware that interpenetrations can result from such an adjustment. For the purposes of this tutorial, Thickness is left at its present value.

To smooth the mesh and reduce instances of interpenetrations, edit the Quality Settings.

To edit the Quality Settings

  1. In the Attribute Editor, select the nCloth_ShirtShape tab.
  2. In the Quality Settings section, set the following:
    • Max Iterations: 12000.
    • Max Self Collision Iterations: 8.
    • Turn on Trapped Check.
    • Turn on Self Trapped Check.
  3. Cache the simulation (nDynamics menu set, nCache > Replace Cache) and play it back.

Fine tuning the simulation

To further improve the quality of the simulation and reduce the instances of interpenetration in problem areas, such as the bunching of the shirt in the chest area (see frame 1040) you can set Push Out and Push Out Radius. Try setting the attributes values between the following ranges:

  • Push Out: 0.1—20
  • Push Out Radius: 10—50

Experiment with your settings by creating duplicates of the meshes at specific frames of the simulation. For example, create mesh duplicates at frames 1040 and 1043. Cache the simulation, and then scrub through the Time Slider and compare your simulation with your duplicate mesh to see the results of your attribute edits.

Comparing the final low resolution simulation with the simulated reference character mesh

In this lesson, you compare the final simulation result of the nCloth shirt and nCloth pants objects with the simulated reference character object (the original simulated high resolution mesh).

To compare the simulations

  1. Hide the Shirt_LowRes and Pants_LowRes objects, selecting by selecting them in the Outliner, and then selecting Display > Hide > Hide Selection.
  2. Show the Shirt_HighRes and the Pants_HighRes objects by selecting them in the Outliner, and then selecting Display > Show > Show Selection.
  3. Using the Display Layer editor ( Channel Box/ Layer Editor> Display Tab > Layers > Set Selected Layers ), turn on Visible to display the Reference_Character object.
  4. In the Shading menu, turn off Wireframe on Shaded.
  5. Scrub through the Timeline, to compare how the nCloth meshes behave in the animation. Dolly and tumble the scene so that you can closely observe the problem areas.
    Note

    If the Reference_Character is not animated in the scene view when you play back or scrub the simulation, you may need to reconnect the reference character’s caches to their respective objects. See Reconnecting objects to existing caches.

There are subtle differences in the way the high resolution and reference character objects simulate, but overall the nCloth behaves in similar ways. Considering the amount of time saved by repeatedly working through the simulation workflow of caching the simulation and adjusting attributes on the low resolution mesh, this workflow provides good results. Although the reference character object can be improved by optimizing the simulation, the higher resolution mesh slows down caching and simulation time and might require more attribute adjustments.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License