Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Fluid ignores colliders on certain amount of particles (compute backend)
#2
(17-02-2025, 03:00 PM)JulijaF Wrote: I initially ran into an issue with the compute backend struggling when handling a large number of colliders in the scene. The fluid wouldn't collide with anything, but I found a fix on the forum by adjusting:
Code:
#define MAX_CONTACTS_PER_SIMPLEX 32 → 512
This resolved the problem, but only up to a certain number of particles.

Hi there!

The problem is not the total amount of colliders in your scene, but the total amount of colliders near the same area. The reason for this is that it is not possible for a GPU to allocate memory dynamically, so memory for a maximum amount of colliders per voxel must be preallocated. This is hardcoded as 32 as you found out, you can increase it to 512 but this will have an impact on memory and performance.

Even then, there's a hard limit to the amount of simultaneous particle-collider contacts in a scene: 262144. Once this limit is surpassed, any new contacts will begin to be randomly discarded. This limit is established in ComputeColliderWorld.cs

It's not common to have more than 100k particles in a scene as performance starts to become a problem. Only particles near the surface of the fluid collide with anything directly, and when they do each particle usually doesn't collide with more than 2-3 colliders so this limit seemed reasonable.

However based on your videos, it doesn't seem like there's more than 32 colliders per voxel or more than 262k contacts. The fact that one or both limits seems to be reached in your game is maybe an indication of a pathological setup? Would it be possible for you to send an example project to support(at)virtualmethodstudio.com that reproduces this issue, so that we can take a closer look?

kind regards,
Reply


Messages In This Thread
RE: Fluid ignores colliders on certain amount of particles (compute backend) - by josemendez - 17-02-2025, 03:35 PM