Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WaitForAllTasks spent a lot of time!
#11
(21-09-2017, 03:25 PM)lidiamartinez Wrote: You can use WeTransfer website. Then send us a link. Please, write to   support@virtualmethodstudio.com  Note this email is only for private queries like this.

Hi,

My project has uploaded to this address:
/*Removed for privacy*/
Please check. The scene path is Assets\LabTest\Lab\Scene\009_Controller_BezierPointer 1.unity
Reply
#12
(21-09-2017, 04:05 PM)sunyifeng83 Wrote: Hi,

My project has uploaded to this address:
XXXXX
Please check. The scene path is Assets\LabTest\Lab\Scene\009_Controller_BezierPointer 1.unity

Hi!

The issue with your project is the "bottle_3" mesh. It has about 3600 triangles, which is extremely dense for a MeshCollider. This is causing 3,6 million triangle/particle collision tests with the fluid per frame. Also, most of these triangles are clumped in the bottom or around the border of the container in a very tight space, so spatial culling can do very little to avoid having to test them all.

By moving this container away from the fluid jet, the simulation time goes down to bout 2-3 ms in my computer. Getting it close to the jet again, and simulation time goes up to 20-25 ms.

Try using a simpler mesh for the collider. Note that you can (and should) use different meshes for rendering and physics, as it is common in video games.
Reply
#13
(21-09-2017, 04:19 PM)josemendez Wrote: Hi!

The issue with your project is the "bottle_3" mesh. It has about 3600 triangles, which is extremely dense for a MeshCollider. This is causing 3,6 million triangle/particle collision tests with the fluid per frame. Also, most of these triangles are clumped in the bottom or around the border of the container in a very tight space, so spatial culling can do very little to avoid having to test them all.

By moving this container away from the fluid jet, the simulation time goes down to bout 2-3 ms in my computer. Getting it close to the jet again, and simulation time goes up to 20-25 ms.

Try using a simpler mesh for the collider. Note that you can (and should) use different meshes for rendering and physics, as it is common in video games.

Hi jose,

Thank you. It's really the cause. But I have made the bottle_3's meshcollider to using inflate mesh. And i saw the triangles of the collider had been reduced a lot. The inflate mesh for the collider didn't work?? I was comfused. Can you tell me why?
Reply
#14
(22-09-2017, 03:48 AM)sunyifeng83 Wrote: Hi jose,

Thank you. It's really the cause. But I have made the bottle_3's meshcollider to using inflate mesh. And i saw the triangles of the collider had been reduced a lot. The inflate mesh for the collider didn't work?? I was comfused. Can you tell me why?

Inflate mesh turns concave meshes into convex ones. So your bottle would have no "hole" in the top and would not be able to be filled with any liquid. For this reason, Obi treats all mesh colliders as concave, regardless of the "inflate" settings.

If your intention is to fill the bottle with liquid, you cannot use inflate mesh anyway as the resulting mesh is always convex.
Reply
#15
(22-09-2017, 07:35 AM)josemendez Wrote: Inflate mesh turns concave meshes into convex ones. So your bottle would have no "hole" in the top and would not be able to be filled with any liquid. For this reason, Obi treats all mesh colliders as concave, regardless of the "inflate" settings.

If your intention is to fill the bottle with liquid, you cannot use inflate mesh as it requires the mesh to be convex.

Hi jose,

Thank you. Understood. I saw in the exmple scene FaucetAndBucket, The bucket has 2880 tris, With 1000 particles, This will cause 2.88 million triangle/particle collision tests with the fluid per frame. Why that sample's performance not that bad?
Reply
#16
(22-09-2017, 08:31 AM)sunyifeng83 Wrote: Hi jose,

Thank you. Understood. I saw in the exmple scene FaucetAndBucket, The bucket has 2880 tris, With 1000 particles, This will cause 2.88 million triangle/particle collision tests with the fluid per frame. Why that sample's performance not that bad?

In that particular example, the triangles are evenly distributed across the bucket's mesh. 

Obi uses a spatial partitioning structure known as "bounding interval hierarchy" to store the mesh triangle's and ignore those that are not near a given particle when testing for collisions. This structure uses the triangle's bounding boxes to discard those far away from the particle.

So the collision test for each particle first traverses this structure, and in a few steps it has determined most of the triangles in the mesh that can be ignored. Then it only performs the expensive triangle/point test for the remaining triangles, which are usually just 3-4 tris per particle. For 1000 particles this means only 3000-4000 tests, which is doable.

Your mesh however is a worst-case for this, because most triangles are clumped in two zones: the top of the bottle, and the bottom. This means that the bounding boxes of the triangles overlap almost completely those of their neighbors, making any efforts to discard any of them ineffective. So in the end, each particle needs to be tested with almost all the triangles.

3,6 million tests/frame is an upper bound estimation and not a fixed number, probably less tests are being actually performed as the bottom triangles and the top triangles are far from each other -thus easily culled- but still enough to cause performance problems. Also the fact that the triangles are smaller that the particles means that each particle hits more bounding boxes, making the problem worse.

Best luck with the project, if you need further help or have questions do not hesitate to ask Sonrisa
Reply