Obi Official Forum
Performance - 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: Performance (/thread-2368.html)



Performance - anulagarwal - 15-07-2020

Hi,
In Unity Editor my FPS drops to 15-20 FPS, So if i build for Android it is possible it will drop further right?
I am using Obi Fluid and would like my blueprint to have a capacity of around 2500 if possible!

What can be the solution to optimize the performance?


RE: Performance - josemendez - 15-07-2020

(15-07-2020, 12:02 PM)anulagarwal Wrote: Hi,
In Unity Editor my FPS drops to 15-20 FPS, So if i build for Android it is possible it will drop further right?
I am using Obi Fluid and would like my blueprint to have a capacity of around 2500 if possible!

Hi,

Profile your scene. Performance issues can be to a huge number of causes, from physics entering death spiraling to rendering issues, and it's pretty much impossible to tell without profiling.

If you want, you can post a profiler pic here and I'll help you interpret it.


RE: Performance - anulagarwal - 15-07-2020

Hey,
I am just emitting the particles and nothing else, no script or anything as well!
Here is a screenshot

[attachment=746]


RE: Performance - josemendez - 15-07-2020

(15-07-2020, 12:40 PM)anulagarwal Wrote: Hey,
I am just emitting the particles and nothing else, no script or anything as well!
Here is a screenshot


Hi,

Just with the graph there's nothing I can do, as I don't know what calls are being made or anything to be able to interpret it. You need to post the full profiler window in either timeline or expanded hierarchy mode.


RE: Performance - anulagarwal - 15-07-2020

[attachment=747]


RE: Performance - josemendez - 15-07-2020

Physics is being updated 6 times per frame in your scene, so it's 6 times slower than it could be. Ideally physics should only be updated once. This is typically known as "death spiralling" and is a very common issue in engines that use a fixed-timestep scheme, such as Unity.

You can try either increasing your fixed timestep, or lowering your max fixed timestep. You can find these settings in Unity's Time manager:
https://docs.unity3d.com/Manual/class-TimeManager.html

If you want to know about fixed time stepping, the physics update cycle and death spiralling, there's many resources online:
https://gafferongames.com/post/fix_your_timestep/
https://johnaustin.io/articles/2019/fix-your-unity-timestep
https://docs.unity3d.com/Manual/ExecutionOrder.html

When working with physics engines (specially highly demanding simulators, such as Obi) it's extremely important to understand time stepping: what it is, how it works and what tradeoffs it presents.

kind regards,


RE: Performance - anulagarwal - 15-07-2020

But how do i fix this for Obi?
Currently I am not using any additional scripts, so can i fix the timestep?


RE: Performance - josemendez - 15-07-2020

(15-07-2020, 03:39 PM)anulagarwal Wrote: But how do i fix this for Obi?
Currently I am not using any additional scripts, so can i fix the timestep?

Timestep length is a global setting in Unity, it affects all physics going on in your game.

I get the feeling that the fact the blue part of the profiler graph is named "scripts" is confusing you: everything in Unity that's not built-in in the engine will show up in the profiler as "scripts", this includes Obi, as well as any other stuff running in the CPU. Having additional scripts or not has no relevance in this case, as the issue is clearly timestep related: the wall-clock time it takes for Obi to simulate one timestep is larger than the game time simulated by the step, so Unity is forced to take multiple physics steps per frame to compensate for this, until it hits the max timestep value.

Increasing the timestep length or reducing the maximum timestep time would fix the issue, as I suggested. Ideally, you could also tweak the simulation parameters and/or use less particles to make each step less costly.


RE: Performance - josemendez - 15-07-2020

(15-07-2020, 12:02 PM)anulagarwal Wrote: I am using Obi Fluid and would like my blueprint to have a capacity of around 2500 if possible!

2500 particles being simulated simultaneously in 3D in a mobile device is close to unfeasible, unless they're very sparse (far from each other to minimize density interactions) and the device is really powerful. Going over 1000 particles is not recommended on mobile.

Of course you can have a blueprint capacity of 2500 particles, as long as you make sure not all of them are being simulated at once.