PhysX 3.3 cloth framerate drop with PxClothFlag::eSCENE_COLLISION

when I enable PxClothFlag::eSCENE_COLLISION for the cloth and start rotating it with setTargetPose() once it gets to a certain speed frame rate drops to a crawl until I destroy the cloth. happens with or without gpu enabled. if no scene collisions are enable everything works fine.

anyone else experienced this?

Sorry to bump an on old thread but i am getting this exact same problem. Happening with both 3.3.1 and 3.3.2. With PxClothFlag::eSCENE_COLLISION set to true i get

“…\foundation\src\PsFoundation.cpp (268) : abort : User allocator returned NULL.”

Which obviously means the default memory allocator is failing to allocate memory.

set PxClothFlag::eSCENE_COLLISION to false and all is good. My cloth mesh is tiny, 80 verts.

I have also noticed if a disable my terrain the problem goes away too (if i use a smaller terrain the problem goes away also). What ever is happening physx is trying to allocate a massive amount of memory on the first call to scene->simulate

My terrain is only 2048x2048, certainly not that big and if i remove the cloth everything also runs perfectly on this terrain size. Also if i enable PxClothFlag::eSCENE_COLLISION but comment out the call to cloth->lockParticleData(physx::PxDataAccessFlag::eREADABLE) in the render tick function the problem disappears too

Also no GPU enabled for cloth or PxScene

The PxCloth implementation in PhysX-3 is designed primarily for the clothing use case. The problem you describe here is that the mechanism for collision detection between the cloth and the terrain can be expensive. You should disable the collision detection between cloth and static terrain until you actually need it, don’t leave it on all the time. How big is the cloth with respect to the terrain? The terrain has >4M vertices, how many vertices of terrain are covered by the flag when it drops on the ground?

Thanks for the reply mike,

The cloth never even touches the terrain at any stage, the cloth is fixed and hanging in the air. Kind of like a flagpole.

I will try your suggestion though of disabling collision between the two anyway and see if that fixes it because i actually never need collision between terrain & cloth

The collision cost doesn’t occur only when the cloth actually touches the ground. In order to prepare for the case where the cloth might touch the ground, the pipeline performs a scene query on the nearby environment, gathers up the geometry and inserts it into the cloth collision rig for narrow-phase collision testing. Sounds like turning off the collision is the right way to go for you.

Just an update to this. I suppressed collisions between terrain and cloth object in the filter shader and everything works fine now with cloth and PxClothFlag::eSCENE_COLLISION=true. Other objects can collide with the cloth just not the terrain.