Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fluid Performance: Primitive Colliders vs Mesh Colliders
#1
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.
Reply
#2
(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.
Reply
#3
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!
Reply
#4
(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.
Reply
#5
(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.
Reply