godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.16k stars 21.19k forks source link

Glow extremely Slow with Mobile on Android #98531

Open Kajinor opened 3 weeks ago

Kajinor commented 3 weeks ago

Tested versions

4.4.dev3, (Probably also 4.3)

System information

Windows 10 High-End PC, tested on Android 14, Samsung Galaxy A35

Issue description

With Mobile Renderer enabled, I created an empty scene without a sky or anything, and just put a MeshInstance with a Cube Mesh and a Standard Emissive Material. It renders with smooth 120 FPS on my Galaxy A35.

Then I enable Glow to actually see some glowing. It works on my PC, but on my phone:

  1. The glow is not visible, as if it is turned off somehow.
  2. FPS drops from 120 to 37...

Then I switched to Compatibility Renderer:

  1. Glow is visible now
  2. FPS is back to 120

If I do the same in Unreal Engine, no matter if I use GLES3 or Vulkan renderer there, it is always at 60 FPS and Glow is always working.

So there must be a huge performance issue with turning on Glow/Postprocessing with Mobile Renderer.

I read an official article that SSGI and other effects are not optimized in Godot yet and will improved with upcoming releases, so hopefully Glow will be part of that upcoming optimizations?

Anyway, thanks for your hard work on the engine, just wanted to report this and hope it gets fixed soon. (Still kinda hope there is just a setting I did wrong).

Steps to reproduce

I attached MRP. Basically just make an emissive cube, run on low/mid-range android device with Mobile compared to Compatibility renderer.

Minimal reproduction project (MRP)

slowglowmrp.zip

Calinou commented 2 weeks ago

Try reducing the resolution scale factor in the project settings (Scaling 3D > Scale) to a value between 0.5 and 0.7. Most 3D mobile projects don't render at native resolution for performance reasons.

I read an official article that SSGI and other effects are not optimized in Godot yet and will improved with upcoming releases, so hopefully Glow will be part of that upcoming optimizations

The implementation of glow in Mobile closely follows the one used in Forward+, except it only uses fragment shaders instead of compute (due to poor compute shader support on mobile GPUs).

Compatibility uses a low-end-oriented glow implementation with less options available. It could be ported to Mobile, but this would change the appearance of projects that rely on the current glow implementation (unless we keep two codepaths side-by-side).

Kajinor commented 2 weeks ago

Try reducing the resolution scale factor in the project settings (Scaling 3D > Scale) to a value between 0.5 and 0.7. Most 3D mobile projects don't render at native resolution for performance reasons.

Hmm I tried that, I set the Scaling 3D to 0.5 and the FPS drops even a bit more! It goes down to 28-30 FPS then....

Also, as I mentioned, the Glow is not even visible on mobile, I don't get any glow effect no matter how much I play with the glow related settings (e.g., setting HDR Threshold below 1.0). On PC, the Glow is working. I use Mobile Renderer on PC as well, so its the same Renderer.

Compatibility uses a low-end-oriented glow implementation with less options available. It could be ported to Mobile, but this would change the appearance of projects that rely on the current glow implementation (unless we keep two codepaths side-by-side).

I think you should keep two codepaths then if possible. The thing is, in Unreal and Unity I get decent 60 FPS (probably above if I would stop locking the FPS there) with nice looking glow effects even if I choose Vulkan.

I think glowing is essential for many games. So if Glow makes the game unplayable on a $300 Galaxy A35 mid-range phone, which has just been released in March 2024, then I think an additional code-path is definitely worth it. I mean so far, I only rendererd a Cube without shadows, sky, and other stuff.

The Compatibility Renderer solves this, but it lacks other features like Decals, DOF, etc. which GLES3 Renderer in Godot 3.6 all supports btw. (except for Decals)

So the issue on Mobile with Godot 4.0 in a Nutshell is:

Don't get me wrong, I saw the huge improvements which have been added to Compatibility Renderer with the most recent updates. But I also read that the Compatibility Renderer is now "feature complete" so I don't expect more additions to it.

Right now, Godot 3.6 is actually the much better version if it would have the latest GDScript, GDExtension and Workflow additions like Godot 4.0 has and more frequent updates. Rendering vice, Godot 4.0 in many cases brings less features and poorer performance on Mobile right now and I think that is something which should be changed.

Even on my Apple M1 Macbook Air, Mobile Renderer Glow drags down performance in a way it shouldn't be.

Anyway, I think Godot has great potential on Mobile, please just think about an additional code path OR adding more features to Compatibility Renderer. That would be awesome.