NVIDIAGameWorks / FleX

Other
646 stars 99 forks source link

How to increase weight of cloth without getting this weird simulation behaviors? #106

Open Amir-Arsalan opened 4 years ago

Amir-Arsalan commented 4 years ago

I'm trying to do some cloth simulations with a cloth that is a bit heavy but no matter what value I set for invMass=1.0/newMass I still get pretty weird behaviors (the cloth particles get stuck to each other). If I make newMass to a values smaller than 1.0 I'll start getting a very slow cloth simulation as cloth gets pretty light but if I set it to higher values I get weird simulation results. I also tried changing other parameters such as stiffness and friction to resolve the weird simulation but I still do not get any sensible simulation results.

Here's the best results I could get by changing newMass to values higher than 1.0:

1

And here's the best final result that I could get by increasing the value of lift parameter but this causes the simulation to behave weird in some other ways (the cloth particles attract each other during the simulation). As I said, the final result though better resembles heavy cloth than when I change invMass as you can see below:

1

I know I should not be changing lift to simulate more cloth weight. So I wonder if anyone knows which parameters I should change in order to make the cloth heavier and get a sensible physics simulation process at the same time?

leothomas77 commented 4 years ago

Hello, when you change the invMass of the particles to 0, the expected behavior is that the particle stay adhered or stop, because in PBD algorithm, the particle with invMass = 0 will not update it position anymore. The default value for mass is 0. Did you take a look in the phase and NvFlexMakePhase when create the cloth?

leothomas77 commented 4 years ago

The first example behaves like some particles reach invMass = 0 and adhere

Amir-Arsalan commented 4 years ago

@leothomas77 It's been a while since I tried this and I don't remember if I looked at NvFlexMakePhase when creating the cloth, but most likely I didn't. Could you explain more and/or provide an example?

Amir-Arsalan commented 4 years ago

@leothomas77 I don't think invMass gets closer to 0.0. I remember I set newMass to values like 2.0, 5.0 and 10.0. So invMass didn't go below 0.1.

leothomas77 commented 4 years ago

@leothomas77 I don't think invMass gets closer to 0.0. I remember I set newMass to values like 2.0, 5.0 and 10.0. So invMass didn't go below 0.1.

Even if invMass reaches around zero, the adhesion effect can appear

@leothomas77 It's been a while since I tried this and I don't remember if I looked at NvFlexMakePhase when creating the cloth, but most likely I didn't. Could you explain more and/or provide an example?

I don't have an example now, but take a look in the Sphere Cloth scene (in the source code of Flex showcase), you can see that the procedural creation of the cloth mesh there is an phase attribute. This one configure a filter to Flex handle the self collisions in a particle system. I think that this isn't your problem... by the behavior of the cloth mesh, i think that there is any cloth particle with a invMass nexto to zero

leothomas77 commented 4 years ago

What is your collision model? Are you using the sdf collision or triangle collision?

Amir-Arsalan commented 4 years ago

What is your collision model? Are you using the sdf collision or triangle collision?

I don't know, will look into it and let you know. This might take a few days as I'm now busy with some other stuff. Thank you so much for trying to help.

leothomas77 commented 4 years ago

What is your collision model? Are you using the sdf collision or triangle collision?

I don't know, will look into it and let you know. This might take a few days as I'm now busy with some other stuff. Thank you so much for trying to help.

Ok, you can check the collision model looking for some code like: g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeTriangleMesh, false));

or

g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeSDF, false));

The first adds a triangle mesh and check the collision by a triangle intersection

The second uses a sdf model and can avoid some undesirable behaviours because avoid the interlock problem described here in the Flex paper, in the figure 6. Take a look in this part of documentation to understand better what are hapening... You can also change the collision distance parameter to improve the collision handling if necessary