Does changing light energy per frame cause serious performance problems?

Godot Version

4.3

Question


I am creating a night market.
Initially, I created a light2d node for each light (including the bulbs on the roof). Without a doubt, I met problems with the 16 limit.

Then I tried “Sprite2D” plus “Add Blend” mode, but in very dark environments this solution really sucks.

Now I have divided the night market into sections and created Light2D for each section, most of the night market is already lit and I used “Sprite2D” plus “Add Blend” for the stall signs and other small lights.
The final effect is pretty good, no 16-limit, no bad effect in dark environments.

However, the light2d node textures are very large in order to cover almost the entire night market. In particular, I had to change the energy of the lights at every frame to make them naturally fade from day to night (and vice versa).

Although the editor debugger shows a stable FPS of 120 and 290MB of RAM, I get severe stutter when running the game from the editor. (Currently this problem is not found in the release version.)
I tried disabling the energy changing operation, the stutter disappeared too.

I don’t know the underlying calculations for lighting, but I guess that the size of the light textures and the frequent updating of the energy would lead to heavy calculations that would cause the game to lag.

So, if I really need to have the lights naturally fade from day to night, is there any other way to improve performance?

=============

FYI:
I bought my computer 11 years ago, so the gpu might be a little bad.


It also makes me unsure if it’s a code issue or a computer issue.

If you are using addative textures for lighting that’s peak performance, I assume you can lower the effect of these textures through modulate, so what is the Light doing? What am I to take away from these screen shots?

As with any performance problem, check the profiler, measure twice and all that.