Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Performance Questions
#1
Hello,

I have two questions on performance.

1) Unity Profiler shows spikes approximately once per second on the Oni.WaitForAllTasks() method, even when the fluid is not moving. Is it normal?
I also checked with ObiProfiler, but I didn't notice anything unusual, except the long "Idle (15ms)" label, which seems to be shown on every spike.
I attached screenshots of ObiSolver, Unity Profiler, ObiProfiler and Emitter material.

2) I have a big level with many (about 20) colliders (some of them are EdgeCollider2D). Does it make sence to disable all colliders which are far away from the fluid? 
I have an idea to fetch the fluid grid each frame using Oni.GetParticleGrid() and disable all colliders that don't contains/intersects with any of the fluid cells.
Something like that:
Code:
  // Solver.OnFrameEnd += UpdateCollidersState;
       private void UpdateCollidersState(object sender, System.EventArgs e)
       {
           var cellCount = Oni.GetParticleGridSize(Solver.OniSolver);
           CurrentFluidGridCells = new Oni.GridCell[cellCount];
           Oni.GetParticleGrid(Solver.OniSolver, CurrentFluidGridCells);

           for (var i = 0; i < Colliders.Count; i++)
           {
               var c = Colliders[i];
               var shouldBeEnabled = false;

               for (var j = 0; j < CurrentFluidGridCells.Length; i++)
               {
                   if (IsColliderAABBIntersectsWithFluidGridCell(c.SourceCollider, CurrentFluidGridCells[j].center, CurrentFluidGridCells[j].size*2)) // compare collider.bounds with cell bounds
                   {
                       shouldBeEnabled = true;
                       break;
                   }
               }

               c.enabled = shouldBeEnabled;
               c.SourceCollider.enabled = shouldBeEnabled;
           }

       }
What do you think, will it increase the performace? I'm asking because I can't test it quickly (I have to change a lot of code to implement that)


Thank you.

[Image: n2yV2iG.png]


[Image: s15wdgA.png]
[Image: 1K4tELS.png]


[Image: RbW03ST.png]
Reply


Messages In This Thread
Performance Questions - by rosedev - 01-10-2018, 03:08 AM
RE: Performance Questions - by rosedev - 02-10-2018, 06:48 PM
RE: Performance Questions - by josemendez - 03-10-2018, 08:49 AM
RE: Performance Questions - by rosedev - 07-10-2018, 03:32 AM
RE: Performance Questions - by josemendez - 07-10-2018, 04:01 PM
RE: Performance Questions - by rosedev - 08-10-2018, 11:59 PM