Obi Official Forum

Full Version: Lag issues when pouring a viscous fluid on a torus model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Issue: My game is working fine when I am pouring the viscous fluid on the default 3D objects in Unity engine, but when I am using a torus (the default doughnut-shaped 3D object provided by Blender) I am having a serious lag issue. I just started using Obi fluid and I am unable to understand why this is happening. 

P.S: I am using the default sample scene for viscous fluids provided by Obi. The settings of the Obi components in the case of a torus and the other objects are exactly the same.
I am experiencing the lag both in the editor as well as the build.


Default Shape and Torus comparison video:

 

Is this a bug, and is there any solution to this?
(08-01-2020, 03:47 PM)AnshuJalan Wrote: [ -> ]Issue: My game is working fine when I am pouring the viscous fluid on the default 3D objects in Unity engine, but when I am using a torus (the default doughnut-shaped 3D object provided by Blender) I am having a serious lag issue. I just started using Obi fluid and I am unable to understand why this is happening. 

P.S: I am using the default sample scene for viscous fluids provided by Obi. The settings of the Obi components in the case of a torus and the other objects are exactly the same.
I am experiencing the lag both in the editor as well as the build.


Default Shape and Torus comparison video:

 

Is this a bug, and is there any solution to this?

Hi,

This is not a bug, or a issue in Obi. MeshColliders are extremely costly compared to primitive colliders -boxes, spheres, etc- and should be avoided when possible. Not just in Obi, in Unity too, and pretty much any physics engine.

Each fluid particle must be tested for collisions against multiple triangles of the MeshCollider. The denser the mesh, the costlier collision detection becomes. Compared this a sphere or a box, where each particle can be tested only once (since they're simple shapes, there's an analytical expression for them).

Either reduce the amount of triangles in your torus, or (the preferred approach) use a distance field:
http://obi.virtualmethodstudio.com/tutor...ields.html
(08-01-2020, 03:57 PM)josemendez Wrote: [ -> ]Hi,

This is not a bug, or a issue in Obi. MeshColliders are extremely costly compared to primitive colliders -boxes, spheres, etc- and should be avoided when possible. Not just in Obi, in Unity too, and pretty much any physics engine.

Each fluid particle must be tested for collisions against multiple triangles of the MeshCollider. The denser the mesh, the costlier collision detection becomes. Compared this a sphere or a box, where each particle can be tested only once (since they're simple shapes, there's an analytical expression for them).

Either reduce the amount of triangles in your torus, or (the preferred approach) use a distance field:
http://obi.virtualmethodstudio.com/tutor...ields.html

Thank you! The distance field approach got it working.