NVIDIAGameWorks / NvCloth

297 stars 52 forks source link

[Question] PhysX and NvCloth interaction #54

Closed migpasc closed 4 years ago

migpasc commented 4 years ago

Hi,

I'm a newbie when it comes to physics. I recently started working with PhysX 4.1 and once I got the hang of it I wanted to try adding some cloth to my simulation. After realizing that there was no "PhysX Cloth" in the code that I downloaded (turns out I was reading the documentation of PhysX 3.4, which does seem to include it) I noticed that it was deprecated in favor of NvCloth.

On the main github page it says "PhysX / PxShared compatibility" which made me think that I could merge NvCloth seamlessly into my PhysX simulation but from what I gather it seems that that's not the case. If I understand this correctly I'm supposed to create mirror capsules/spheres from my PhysX simulation and keep that updated on the solver simulation so that PhysX and NvCloth will look like they're working together. Is that correct?

Also, does this mean that it's not possible to create a, for example, horizontal piece of cloth that's hanging from 4 anchor points and then drop spheres on top so those spheres eventually gather on top of the cloth (cloth affecting physx instead of only the other way around)? Is there any other PhysX/nVidia API that will allow for something like that?

Thanks, and sorry if this is not the proper place to ask this (I'll gladly move this conversation somewhere else if pointed to the right location).

mtamis-NV commented 4 years ago

You are correct. NvCloth is the low-level cloth simulation that used to be part of PhysX, wrapped in its own library. In order to make the cloth interact with PhysX objects you need to mirror collision shapes in NvCloth manually. NvCloth only supports one way interaction (the cloth won’t be able to push the PhysX bodies back). You can take a look at flex if you want two way interaction between cloth and rigid bodies: https://developer.nvidia.com/flex PhysX 5.0 may also include similar features: https://news.developer.nvidia.com/announcing-nvidia-physx-sdk-5-0/

migpasc commented 4 years ago

Thanks for the reply, mtamis.

Even if this wasn't what I was expecting at first, I still learnt a lot and can see how for cosmetic cloth this is the way to go. The results are truly amazing!

Cheers!