How to optimize use of Lights

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

I am making a large 3D indoor scene with lots of lights. The performance is very bad the only way of getting realistic lighting is with baked lightmaps and only static lighting. Is there away of optimizing the usages of lights to improve performance while making the lighting and shadows dynamic?

Thank you

:bust_in_silhouette: Reply From: daniklad

Godot 3 is not very good att handling large amounts of dynamic lights in my experience so you will have to be creative. I think Godot 4 will fix this soon.

I don’t know any way to have lots of lights where they are all dynamic at once in Godot 3. If you can make it work with only nearby lights being dynamic and far away lights being static then I think you should be able to solve it with baked lighting and custom shaders that blend between baked lighting and dynamic based on distance.

There are many ways it can fail though so expect it to be a complex and time consuming project.

:bust_in_silhouette: Reply From: Calinou

You can use the Level of Detail add-on to hide shadows and lights in the distance. This is a common technique which is still used by AAA games today.

Also, I would recommend using baked lighting if you can (with static lights’ bake mode set to All instead of Indirect). You can still have dynamic lighting effects by adding lights after lights have been baked, but you’ll want to provide an option to disable dynamic lighting to improve performance on low-end devices.