Obi Official Forum
Fluid Performance: Primitive Colliders vs Mesh Colliders - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Fluid Performance: Primitive Colliders vs Mesh Colliders (/thread-253.html)



Fluid Performance: Primitive Colliders vs Mesh Colliders - writer51 - 24-12-2017

I was wondering if there is documentation anywhere regarding the performance of obi on primitive vs mesh colliders. I seem to be getting a very noticeable performance drop in editor from subscribing to collisions on a mesh collider vs primitive colliders (tested boxes, capsules - all seem fine). Is this just a natural consequence of using mesh colliders- just seem strange, I go from 135 fps with primitives down to 40 fps with mesh collider, everything else being the same.


RE: Fluid Performance: Primitive Colliders vs Mesh Colliders - josemendez - 25-12-2017

(24-12-2017, 03:55 AM)writer51 Wrote: I was wondering if there is documentation anywhere regarding the performance of obi on primitive vs mesh colliders. I seem to be getting a very noticeable performance drop in editor from subscribing to collisions on a mesh collider vs primitive colliders (tested boxes, capsules - all seem fine). Is this just a natural consequence of using mesh colliders- just seem strange, I go from 135 fps with primitives down to 40 fps with mesh collider, everything else being the same.

MeshColliders are extremely costly compared to primitive colliders. This is always the case, however when it comes to collision detection against hundreds of particles (which is what Obi does) the problem is exacerbated. Even though Obi uses a hierarchical data structure to prune collisions against most of the collider's triangles, each triangle in the mesh collider costs roughly the same as single primitive collider.

The next update will feature adaptive signed distance fields. These are basically large arrays that store the distance from any point in space to the surface of the MeshCollider. At runtime, each particle simply has to read a value from this array, and check its sign to see how far from the collider it is or if it has collided or not. These are much faster than regular MeshColliders, and incredibly robust. However they cannot be created at runtime (well they can, but it takes a lot of time) and they consume more memory than regular colliders.


RE: Fluid Performance: Primitive Colliders vs Mesh Colliders - writer51 - 05-03-2018

Was curious if you knew where terrain colliders stood in regards to performance. Would terrain colliders be better or worse than mesh colliders? vs primitives? Thanks!


RE: Fluid Performance: Primitive Colliders vs Mesh Colliders - josemendez - 05-03-2018

(05-03-2018, 07:40 PM)writer51 Wrote: Was curious if you knew where terrain colliders stood in regards to performance. Would terrain colliders be better or worse than mesh colliders? vs primitives? Thanks!

Terrain colliders are about as fast as primitive colliders. This is because they're implemented as height maps, there's no need to collide directly with their geometry. 4 array reads and a bilinear interpolation is enough to get the distance from any particle to the terrain.


RE: Fluid Performance: Primitive Colliders vs Mesh Colliders - writer51 - 06-03-2018

(05-03-2018, 10:41 PM)josemendez Wrote: Terrain colliders are about as fast as primitive colliders. This is because they're implemented as height maps, there's no need to collide directly with their geometry. 4 array reads and a bilinear interpolation is enough to get the distance from any particle to the terrain.

Thank you, this helps me a lot in planning ahead! It was also best case scenario for me.