Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ObiFluid Tunneling Issue - Collisions - Performance tips - Gaps between particles
#2
(05-07-2017, 05:02 AM)binhong87 Wrote: Hello,

I tried your plugin ObiFluid in my project, but encountered these following issues, please provide technical support.

1. I changed collision evaluation method to "sequential", which seems more stable when particle amount increases. Parallel method gets more tunneling issues.
   But the beaker (the mesh collider) still get leaks, when I move the beaker "a little" more heavily. It looks better when moved slowly.
   Can you provide more technical support on addressing this tunneling issue, I saw your documents saying tunneling issue "almost non-existent". :-)

2. The performance gets significantly decreased when particle amount reaches about 2000, only about some 50 fps.
   The CPU usage is about half. Is there any tips on how to optimize the performance?

3. I found that there are many particles stay in the lowest layer, and the others piled up. And there is even a gap between them, when the smoothing is set above 1.0.
   Is it designed this way, or there is some mis-configurations?


Thanks
Bin

Hi Bin,

1.- Moving a MeshCollider by changing its transform is equivalent to teleporting it from frame to frame. No continuous collision detection algorithm exists that can work under these circumstances, since there's no way to predict where the collider is going to move next (it has no velocity). The problem is aggravated by the fact that MeshColliders aren't "solid", but a thin membrane. This means that if a particle gets inside the mesh collider, it cannot be projected outside like it would from a primitive collider (cube, sphere, capsule, etc). 

Continuous collision detection can avoid tunneling in pretty much all cases when: 

- moving particles collide with a non-kinematic rigidbody. Since both the particles and the rigidbody have a velocity vector, Obi can tell where they are going to move in the next frame and act accordingly.

- moving particles collide against a static collider of any kind (including mesh colliders). Most included test scenes take place in an environment made with a MeshCollider, which is paper-thin. However no tunneling issues can be seen there, because the mesh collider doesn't move.

So, general rules for good collisions:

- Dynamic object using a non-kinematic rigidbody: OK
- Dynamic object using transform, has a primitive collider: OK, but no continuous collision detection. Not a problem if the collider is thick enough, since particles inside of it will be projected outside.
- Dynamic object using transform, has a mesh collider: BAD. will miss collisions pretty often, since particles are very small and the collider is a thin membrane.
- Static object of any kind: OK



2.- Try reducing your max physics timestep in Unity. You might be reaching a point where 1 physics step is not enough to simulate each frame, so 2 steps (or more) per frame are being used.


3.- This is completely normal. In particle-based fluids, particles aren't "drops" but small "probes" that carry fluid information (density, vorticity, etc). A single fluid drop can be composed of a single particle or multiple particles, depending on the fluid resolution. They don´t have to touch each other in order to interact. In fact, a larger smoothing radius will cause then to become more separated. Particles tend to accumulate at the bottom to support the weight of the particles on top of them, since more particles = more pressure = it's easier to keep constant density.

If you want your particles to touch each other regardless of their smoothing radius, you can scale the way they are drawn using the "radius scale" property of the ObiParticleRenderer.

I'd recommend taking a look at other particle-based fluid simulations to get a feel of what the concept is. Obi implements PBF (position based fluids), but SPH (smoothed particle hidrodynamics) and MPS (moving particle semi-implicit) are also particle-based and look/behave similarly.





Reply


Messages In This Thread
RE: ObiFluid Tunneling Issue - by josemendez - 05-07-2017, 09:26 AM
RE: ObiFluid Tunneling Issue - by whack - 14-12-2021, 08:30 AM