PDA

View Full Version : nCloth Tips and Tricks


Castius
09-28-2009, 04:57 PM
I have been collecting some notes about nCloth. The notes have been made while using Maya 8.5 -2008.



Scale. If you work at different scale. Adjust your nCloth lift by the same percent%.
Scale = .01 then lift = .0001

Min values for sim steps and collision.
Steps = 7
Collision = 10
Recommended sim values
subSteps = 20
Max Collision iterations = 30 Don’t be afraid to test these values even higher. Higher really can mean faster some times.
For example: If two mesh are intersecting on frame 2. It could take 31 collision steps to free them.
If the collision steps are set to 30 it will never be released from each other. This mean you use the max collision steps every frame.
But if you set your collision to 31. Then for the rest of the sim you will only use 20 subSteps.
If you have to use push out and trap check on nCloth on the same layer. You should know that there are some odd side effects. Where one cloth can pull another along with it. If you use too high a push out radius value and trap check. Be aware that it can causing a cycle in motion. One cloth will try to move way from another and pull the other along with it.
Use separate layers or smaller push out radius can help.
Large push out radius will slow down calculations
Push out and trap check work even if a collision is off!

Friction value is only range between 0-1.
Max friction is nCloth friction set to 1 and passive friction set to 1. Higher values have no effect.
Lower steps will make friction to be less effective.

To avoid turning the Nucleus on and off. Make sure every cloth has a cache applied. Otherwise you need to turn off Nucleus to prevent calculations.
Append cache will not work properly if nCloth has any rigidity value. Unless you append from the start frame.

If there are multiple caches on your mesh. Append cache might not work well. Not sure what cache to append. I have not tested this much yet. I just know it was a problem once.
Using append on multiple meshes pointing to multiple caches. Can cause “play from cache” and “inrange” to be connected to the one cache. This can also cause Subsequent caching. To be cache to the wrong cache. (Not 100% sure on that)
Append and possible replace cache produce different results verses caching with cached turned off. Very small amount, but it’s there.
Constraint are calculated on first frame start regardless if there enabled or not. So large complicated constraints will slow down frame one regardless of their state.
Disabling Constraint does not disable exclude collision.
Disabling Constraint does not disable motion drag.

Weight maps painted on constraints sometimes stop working. Save and reload works ever time. It can be reconnected without reloading but I’m not sure the exact method that works ever time.
Some times set to texture then back to weight works
Caching with a field attached produced cycle warnings.

Fields attached to multiple objects may produced different results from the first item attached. Probable related to the cycle warnings.

It seems if you open a scene with one constraint is linked with multiple nCloth objects, but one of nCloth object is turned off, the constraint breaks and stops working.


I included a scene that show the problem with push out radius and trapcheck.
just set there push out radius to .01 instead of .1 and see the results.

I hope others we be able to share there experiences with nCloth. And add to this thread.

H2
09-28-2009, 05:47 PM
Thanks for the tips! A lot of things in there that I had no idea about. Definitely will come in handy for future projects.

john_homer
09-29-2009, 02:05 AM
Thanks Castius
thats great stuff, I would like to comment on lots of it if you dont mind ;)

I might just do 1 at a time though...
Re: trapCheck...

I included a scene that show the problem with push out radius and trapcheck.
just set there push out radius to .01 instead of .1 and see the results.

I would never use pushout for a shot sim, my understanding is, that it is useful for resolving penetrations for a start mesh, and nothing more.
alias suggest not using trapCheck on cloth, and I agree.
nRigids should have trapeCheck (not pushout)
nCloth should only have slefTrappedCheck (if needed)
although named the same, trapCheck and selfTrappedCheck are completely different..
trapCheck forces the geo out
selfTrappedCheck temporarily dissables self collision on effected faces

john_homer
09-29-2009, 02:44 AM
If anyone has not seen it, the nuclues white paper is available here (http://usa.autodesk.com/adsk/servlet/pc/index?siteID=123112&id=13583699)

It has a lot of great stuff about how nucleus calculates substeps, collisions etc.

Also, some great stuff on constraint weights.
ie, making constraints that are unidirectional
that is, that although 2 cloths are constrained to each other, one will not pull the other..

Anyone interested in delving deeper into nCloth should give this a read.

.j

john_homer
09-29-2009, 03:17 AM
Constraint are calculated on first frame start regardless if there enabled or not. (Probable evaluating rest lengths) So large complicated constraints will slow down frame one regardless of their state.


its probably true that they are calculated, as nCloth seems to evaluate everything at the start frame, however, restlengths are not calculated then (or at least not enforced/used).
The restlength that is used is the distance when the constraint is set to active.

Disabling Constraint does not disable exclude collision.

true, and if you have multiple exclude collision constraints on the same cloth mesh, the membership from the last overrides the others!
this is a recognized bug.

Disabling Constraint does not disable motion drag.

or damp ;(
If keying on/off constraints, its best to also key these 2 attrs

.j

HowardM
09-29-2009, 09:50 AM
Awesome guys, Thanks!
Here is a major Cache bug that may be fixed by now in 2010, havent had a chance to test - http://forums.cgsociety.org/showthread.php?f=86&t=782691

Will get more tips, bugs and tricks up.

Looking forward to this thread growing!

Castius
09-29-2009, 02:56 PM
Yes i agree John. Push out and trap-check should be used sparingly. I should have mentioned that.

You may also be right about constraints calculating rest length on start frame. I will refine my statement. And just say it's calculating something. I'd like to know if Duncan feels it's bug or not. It can pretty annoying.

Castius
10-01-2009, 06:45 PM
I always set my timeline start 1 frame before nCloth start frame.That way if i make an edit. nCloth will not try to reevaluate. While I'm making the change. As well as always make sure nCloth reevaluate all new data.
UV edit do not refresh.If you're using textures to drive any nCloth. And you need to change your UVs.
You must edit the intermediate shape. And nCloth uses a caches version of the UVs. You can run "dgdirty -a;". This will force Maya to reevaluate the whole dag tree.
nCloth can not use multiple UV sets. This is major workflow killer.
(Once again please prove me wrong. PLEASE!!!)

john_homer
10-01-2009, 08:23 PM
Hi Castius

I actually use per vertex map rather than textures. simply for flexibility with the tools we have. so I have no coments there, however, I would like to add, in regards to maps..

Never paint maps outside the 0-1 range. you will get bad results.

I know you would assume that having a value (say bend resistance) of 1, and a map flooded with a value of 10 would give the same results of a value of 10 and a map flooded with 1. but it does not.

also, keep in mind, that as far as evaluations (sim time) are concerned all verts are calculated to the maximum painted vert value.. hmm,, this is difficult to word..

an, example.. with fictional numbers...
say you have a cloth with a stretch of 100, it sims at 1 sec per frame.
you turn up the stretch to 1000 and it will slow down, say to 5 seconds per frame

you might assume that if you flood the weights to a value of 0.1 (essentially bringing the resulting values back to 100) that the sim time goes back to 1 sec per frame. and you would be correct... however, if you set only 1 vert to a value of 1, the sim time will go all the way back up to 5 seconds

this is just the way nCloth evaluates. in the same manner..
the sim will only be as slow as the highest stretch/compression/bend value.

ie, if you have a stretch resistance of 100, then increasing compression resistance from 40 to 100 should not increase sim times.

.j

Castius
10-05-2009, 05:44 PM
In Maya 2008 some times Maya will crash on scene open.
This can be because your timeline is not as frame 0. If this happen open up uyour ascii file in a text editor. And search for " time1" and underthat you will see "setAttr -k on ".o"". Set this line to "setAttr -k on ".o" 0;". Save and your scene should open.
(Does not crash in maya 2009)

john_homer
10-15-2009, 09:05 PM
In general I consider the append to cache useless, its buggy and tends to just give bad results..
I was just testing ripping some cloth with a pointToPoint constraint using glueStrength and noticed it is even worse than I remembered.

the constrain just breaks at the first reSim frame, even with no tension.. and other random results..

say no to append to cache!

.j

Castius
10-15-2009, 10:20 PM
I agree! I would love for append to work flawlessly. It should not have so many problems. But currently it isn't.

But If i really need to append your cache after your start frame. You can go to the start frame of your sim. Hit "step forward one key" one or twice to move a few frames. This will rebuild the needed data. Then move to the frame to append. Finally hit append. Unless you're using rigid values this should work.

HowardM
10-16-2009, 09:24 AM
yeah it seems to me that append is finicky...

not sure if this is set in stone, but Ive found if you remove cache frames further down the time line, ie. you want to append at 5, but have cached frames from 6 onward, you need to kill 6 onward before append works...

also agree sometimes something like going to the start frame to reset, then scrubbing closer to the append range works...

but its tough to tell if this is really going on or just luck... :(

maybe Duncan can chime in about this?

ph2003
10-19-2009, 08:33 AM
Don’t be afraid to test these values even higher. Higher really can mean faster some times.
For example: If two mesh are intersecting on frame 2. It could take 31 collision steps to free them.
If the collision steps are set to 30 it will never be released from each other. This mean you use the max collision steps every frame.
But if you set your collision to 31. Then for the rest of the sim you will only use 20 subSteps.

hi there,
is there anyway to calculate 31 collision steps will free the intersection for 2 mesh? and 30 will not?

ive always been working starts with substeps:8 collision steps 8 (well it works pretty much all the scenes i did)
when i had more than 2+ mesh intersecting each others, always wasting alot time to figure how much steps that i should needed. (when the scenes had over 400+ frames and the intersection parts was at the 350frame thats tooks alot time.)

Castius
10-19-2009, 05:50 PM
I don't see any way to know without testing. I'd love to see some diagnostic info returned by the nucleus. So you could better determine problem areas.

But remember the max collision is just that. It will alwasy do the min collisions unless it needs it. (The minimin collision steps is the substep value) So setting the max collision shouldn't be to much of a concern. If it is then there may be something else you should be doing about the sim setup.

You can also animate these values if need be.

ph2003
10-20-2009, 07:41 AM
yep animate the steps value did save alot time :)

rsj123
02-22-2010, 04:36 PM
Great thread, got to know so many things,

I have few basic questions about ncloth..

1. what is the difference between glue strength and strength in any dynamic constraint. how does it work?

2. what is crossover push? when do we use it?

3. if i am getting some nice wrinkles on my cloth object and then i want to retain them..what should be the best way to do that? (is this something to do with bend angle dropoff or restitution angle?)

4. In maya 2009, does nclothvertexEditor script run? (to paint dynamic properties by selecting the vertices). it opens a window but when i select the vertices of my cloth object, the options are still disabled in the window...m using maya 2009 - linux.

Thanks.
Rohit

Castius
02-22-2010, 05:01 PM
1 and 2 are pretty simple manual questions. Not to be rude but they are very easy to find.

3 That could be handled with a separate mesh as rest shape. I would duplicate your original ncloth mesh. Then make morphs of all the wrinkles you want on that mesh. Once your done connect this new mesh as the rest-shape. When you want those wrinkles in your cloth animate on the morphs for those wrinkles.

edited:
4 Not working in 2009

tpalamar
02-22-2010, 05:34 PM
Another huge consideration when dealing with nCloth is the geometry you plug into it, mainly with clothing. I did a bunch of tests with nCloth and got drastically different results based on the type of geometry, edge flow, and face area.

Castius
02-22-2010, 07:12 PM
Mesh density and topology is a huge factor in designing your sim rigs. Plus setting scale relation will play a big role once you have applied nCloth.

rsj123
02-23-2010, 02:37 PM
thanks Castius..i got the answer of my first question, for my second question (crossover push) I was just expecting for the answer in more simpler way..as I couldnt get it exactly after reading the ncloth manual... :(

and ya..rest shape seems to be a good idea..will try that..thanks a lot. ! :)

- Rohit

Castius
02-23-2010, 04:02 PM
Ahh ok. Well crossover is a more complicated collision method. It doesn't just check if an nCloth is contacting a nRigid mesh. It also checks to see parts of the mesh are inside and outside a nRigid mesh.

http://img399.imageshack.us/img399/4920/conesphere.jpg

The point of this cone mesh is well past contacting the surface of the sphere. nCloth normal collision will not know what to do with this. So if this happens it will be hard for the point of the cone to escape the sphere once inside. With crossover it would know that parts of the cone are outside the sphere and till it to push the tip of the cone out of the sphere.

This is very slow to calculate. So if you need crossover push try to animate it on and off. So the rest of your simulation does not suffer from having it on.

rsj123
02-23-2010, 04:07 PM
Ohh okk...Got it..I sometimes get into such problems.. will definitely try it next time..

.thanks a lot...it was really helpful !

-Rohit

CGTalk Moderation
02-23-2010, 04:07 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.