Perfomance Issues using Light2D with Normal-Maps

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By otherMonkey

I’m making a mobile game with some Light2D and normal Maps for the sprites. On desktop it works pretty fine. But when I run it on my middle-class mobile phone the FPS falls down 50 with only 2 lights.
Is there some way to use Light2D and normalmaps for mobile-dev, or should I forgo this?

Additional Info:
I used a lot of individual texture and normal map files. Off course batching was not very successfull so. This was no recognizeable performance problem anyway. But because of the light problem I tried using Texture Atlases instead. So without lighting the batching worked fine, but with lighting the batching hardly did anything.

I need to render around 50 Sprites and 6 Lights on Screen. The whole scene should be able to contain 500 Sprites and 20 Lights.

Thanks a lot for help!

:bust_in_silhouette: Reply From: Calinou

In Godot 3.x, 2D lights are rendered with a multipass approach, which is very slow when you have several lights. Also, make sure to avoid very large sprites as these will have to be redrawn entirely every time a light touches them. Godot 4.0 will use single-pass lighting in 2D, which is much faster.

As a workaround, you can reduce the rendering resolution of the project by using the viewport stretch mode and using a base window size such as 1280×720 (or 720×1280) in portrait mode, possibly even less. See Multiple resolutions in the documentation for more information.
Even then, this may not be enough, so using sprites with an additive blend mode will likely be the only alternative. These can’t have shadows or normal maps though.

Ok I see. Thank you for the fast answer! I will use the “additive blend mode” approach.
It just would had been a nice to have and the game mechanics doesn’t depend on it.

Looking forward godot 4.0!

otherMonkey | 2021-12-09 11:22