Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
Hello. Our task is to make a simulation of pouring beer into a glass with the generation of foam for mobile devices. After some searches and tests, we decided to purchase your asset, it is truly magnificent. Our idea is quite simple - this is a 2d game with beer pouring into a glass.
Alas, we ran into a performance issue. When using ObiFluidRenderer on mobile devices, we get 1-5 fps. This is not at all what we would like.
I read that Obi is well optimized and therefore confident that it is capable of more.
Also in Obi there is ObiFluidRendererFeature, which is designed for use with LWRP / URP. I tried using this, but unfortunately the result was similar.
Perhaps we are somehow doing it wrong.
Tell me, please, how to use Obi for the purposes we need? Maybe there is a video tutorial on Obi + mobile?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
20-04-2020, 02:49 PM
(This post was last modified: 20-04-2020, 02:58 PM by josemendez.)
(20-04-2020, 01:58 PM)Nyarlukhotep Wrote: Hello. Our task is to make a simulation of pouring beer into a glass with the generation of foam for mobile devices. After some searches and tests, we decided to purchase your asset, it is truly magnificent. Our idea is quite simple - this is a 2d game with beer pouring into a glass.
Alas, we ran into a performance issue. When using ObiFluidRenderer on mobile devices, we get 1-5 fps. This is not at all what we would like.
I read that Obi is well optimized and therefore confident that it is capable of more.
Also in Obi there is ObiFluidRendererFeature, which is designed for use with LWRP / URP. I tried using this, but unfortunately the result was similar.
Perhaps we are somehow doing it wrong.
Tell me, please, how to use Obi for the purposes we need? Maybe there is a video tutorial on Obi + mobile?
Hi,
While Obi is indeed extremely well optimized (fully multithreaded, hand-optimized simd, data-oriented design written in unmanaged code), this does not mean you can throw anything to a mobile device and get the same performance you get in a desktop computer. Profile your game. I cannot stress enough the importance of this. Mobile devices are completely different beasts compared to desktop computers, and their requirements/performance profile are very different.
Off the top of my head, I can think of two potential culprits for general low-performance on mobile devices:
- Death spiraling. This is very often a cause of terrible performance for physics-intensive applications, not just when using Obi, but any physics engine. There's many threads on the forums regarding this, and many good online resources that explain it very well and how to deal with it. If you find that FixedUpdate() is being called more than once per frame according to your profiler, there's a good change this is the issue. Try reducing your max fixed timestep to limit the amount of time Unity can spend per frame on physics.
- Too expensive rendering: Mobile devices are extremely fillrate -limited. Obi's built in fluid renderer is a kind of deferred renderer, and most mobile devices have high-density screens. Pair both, and you have a very expensive per-fragment shader that must be run several times per pixel in a high-density screen using a moderately powerful GPU = slow rendering. That's why ObiSimpleFluidRenderer exists, and why the rendering pipeline was designed to be easily extensible to accommodate custom renderers. Again, you will find if this is your case by profiling. In that case, try using ObiSimpleFluidRenderer instead. See: http://obi.virtualmethodstudio.com/tutor...ering.html
We're able to get +60 fps on an iPhone 7, 1000 particles on screen using the simple renderer and making sure no death spiraling takes place, so there's a good chance you're being bitten by one of the two (or the two) issues I mentioned.
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
(20-04-2020, 02:49 PM)josemendez Wrote: Hi,
While Obi is indeed extremely well optimized (fully multithreaded, hand-optimized simd, data-oriented design written in unmanaged code), this does not mean you can throw anything to a mobile device and get the same performance you get in a desktop computer. Profile your game. I cannot stress enough the importance of this. Mobile devices are completely different beasts compared to desktop computers, and their requirements/performance profile are very different.
Off the top of my head, I can think of two potential culprits for general low-performance on mobile devices:
- Death spiraling. This is very often a cause of terrible performance for physics-intensive applications, not just when using Obi, but any physics engine. There's many threads on the forums regarding this, and many good online resources that explain it very well and how to deal with it. If you find that FixedUpdate() is being called more than once per frame according to your profiler, there's a good change this is the issue. Try reducing your max fixed timestep to limit the amount of time Unity can spend per frame on physics.
- Too expensive rendering: Mobile devices are extremely fillrate -limited. Obi's built in fluid renderer is a kind of deferred renderer, and most mobile devices have high-density screens. Pair both, and you have a very expensive per-fragment shader that must be run several times per pixel in a high-density screen using a moderately powerful GPU = slow rendering. That's why ObiSimpleFluidRenderer exists, and why the rendering pipeline was designed to be easily extensible to accommodate custom renderers. Again, you will find if this is your case by profiling. In that case, try using ObiSimpleFluidRenderer instead. See: http://obi.virtualmethodstudio.com/tutor...ering.html
We're able to get +60 fps on an iPhone 7, 1000 particles on screen using the simple renderer and making sure no death spiraling takes place, so there's a good chance you're being bitten by one of the two (or the two) issues I mentioned.
Thanks for the answer. The profiler shows that the problem is in rendering. Unfortunately, the profiler does not support the GPU of my device, however, I see that VSink takes an incredibly long time waiting for the renderer.
I absolutely understand that although the Obi is optimized, it will not behave like on desktop devices, but I still hope to get at least 20 fps. I already tried changing the depth buffer values for GetTemporaryRT in ObiFluidRendererFeature, alas, to no avail...
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
20-04-2020, 05:44 PM
(This post was last modified: 20-04-2020, 05:44 PM by josemendez.)
Try using ObiSimpleFluidRenderer (using the built-in render pipeline). It does not deal with so many offscreen buffers (specially depth, since it's designed for 2D) and performs much better in most mobile devices.
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
(20-04-2020, 05:44 PM)josemendez Wrote: Try using ObiSimpleFluidRenderer (using the built-in render pipeline). It does not deal with so many offscreen buffers (specially depth, since it's designed for 2D) and performs much better in most mobile devices.
Yes, we tried, ObiSimpleFluidRenderer really works much faster, as I wrote above, but does not give the desired result.
Can we add fluid transparency and foam generation when using ObiSimpleFluidRenderer?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
20-04-2020, 06:04 PM
(This post was last modified: 20-04-2020, 06:09 PM by josemendez.)
(20-04-2020, 05:57 PM)Nyarlukhotep Wrote: Yes, we tried, ObiSimpleFluidRenderer really works much faster, as I wrote above, but does not give the desired result.
Can we add fluid transparency and foam generation when using ObiSimpleFluidRenderer?
Yes, but you'll have to implement it yourself. Both renderers are just built-in examples that cover both ends of the spectrum:
- ObiFluidRenderer: really detailed, high quality (but demanding)
- ObiSimpleFluidRenderer: basic, but fast
They both have a common rendering interface that you can implement for your own needs, similar to what Unity does with URP and HDRP. The simple fluid renderer only supports tinted refraction, nothing else. If you need to add transmission (which is what I think you mean by "transparency") and foam on top of it, you'll need to write your own hybrid renderer. See http://obi.virtualmethodstudio.com/tutor...ering.html for more info.
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
(20-04-2020, 06:04 PM)josemendez Wrote: Yes, but you'll have to implement it yourself. Both renderers are just built-in examples that cover both ends of the spectrum:
- ObiFluidRenderer: really detailed, high quality (but demanding)
- ObiSimpleFluidRenderer: basic, but fast
They both have a common rendering interface that you can implement for your own needs, similar to what Unity does with URP and HDRP. The simple fluid renderer only supports tinted refraction, nothing else. If you need to add transmission (which is what I think you mean by "transparency") and foam on top of it, you'll need to write your own hybrid renderer. See http://obi.virtualmethodstudio.com/tutor...ering.html for more info.
Thanks for the quick answers. We will try.
I think that the use of fluid on mobile devices is really a burning topic and it would be really cool if you paid more attention to this and more examples.
Thanks again!
|