Lesson Setup
To ensure the lesson
works as described, do these steps before beginning:
- If you have not already done so, copy
the nCloth Advanced Tutorial folder from the following location: www.autodesk.com/maya-advancedtechniques.
Then, set the nCloth AdvancedTechniques directory
as your Maya project.
For this lesson, you
need to access Maya geometry cache files in addition to the lesson
scene file.
- Open the scene file named Character_LowRes_4.mb.
This file can be found
in the AdvancedTechniques directory
that you set as your Maya project.
- Import the geometry caches which animate
the character’s body and shoes. See
Importing geometry caches.
- 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,
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:
- Turn off the visibility for the Reference_Character
object in the Display Layer editor.
- Hide the Pants_HighRes object.
Converting the shirt to
nCloth
To convert the shirt to nCloth
- Show the Shirt_LowRes object by selecting
it in the Outliner, and then selecting Display
> Show > Show Selection.
- Select the low resolution shirt object
(Shirt_LowRes) and select
nMesh > Create nCloth > .
The Create
nCloth Options window appears.
NoteIf the
nCloth menu
set appears in the Maya interface do not use it. You must use the
nDynamics menu
set to create and control nCloth. See
nCloth menu set appears in Maya for
information about removing the nCloth menu set from Maya.
- From the Solver drop down list, select
nucleus1.
- Click Create Cloth.
The low resolution shirt
is converted to an nCloth object, and is added to the existing Maya
Nucleus solver.
- 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 .
- Cache the nCloth shirt simulation by
selecting nCloth_Shirt in the Outliner and
selecting nCache > Create New Cache.
- 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 shirt is riding too
high on the character’s body and the polygon faces in the front
of the shirt are deforming poorly.
- Between frames 1040 and 1098, some of
the shirt’s vertices are trapped within the object, 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
- In the scene view, select the nCloth
shirt.
- In the Attribute Editor,
select the nCloth_ShirtShape tab.
- Click-hold the Presets button.
- 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 the 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 nCach
> 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
- Show the Shirt_HighRes object by selecting
it in the Outliner, and then selecting Display
> Show > Show Selection.
- In the scene view, -select
the nCloth shirt object.
- From the Animation menu set, select
Create Deformers > Wrap> .
- In the Create Wrap Options window,
turn on Exclusive Bind.
- Click Create.
A wrap node appears in
the Attribute Editor, and a Shirt_LowResBase object
appears in the Outliner.
- 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.
- Between frames 1039 and 1049, in the
chest area, the shirt deformations have improved, but the polygon
faces still protrude too far outward to resemble the realistic behavior
of a t-shirt.
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
- In the Attribute Editor,
click the nCloth_ShirtShape tab.
- In the Dynamic Properties section,
make the following settings:
- Stretch Resistance:
55
- Compression Resistance:
3
- Bend Resistance:
0.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. This exposes the nRigid_Body object, which might
be a desired result.
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.
- At frame 1042, there are still too many
quads bunching up in the shirt at the character’s chest, causing
interpenetrations. Although this behavior can be considered realistic,
reducing interpenetrations in this area would make the shirt’s behavior
more realistic.
To smooth the mesh and
reduce instances of interpenetrations, edit the Collisions and Quality
Settings.
To edit the Collisions and Quality
Settings
- In the Attribute Editor,
select the nCloth_ShirtShape tab.
- In the Collisions section,
set the Self Collision Flag to Full
Surface.
- 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.
- Cache the simulation (
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
- Hide the Shirt_LowRes and Pants_LowRes
objects, selecting by selecting them in the Outliner,
and then selecting Display > Hide > Hide Selection.
- Show the Shirt_HighRes and the Pants_HighRes
objects by selecting them in the Outliner,
and then selecting Display > Show > Show Selection.
- Using the Display Layer editor, turn
on Visible to display the Reference_Character object.
- In the Shading menu,
turn off Wireframe on Shaded.
- 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.
NoteIf 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.