RectAreaLight cost for deffered rendering

Hi, I am currently working on project, where user in configuration import model in GLB format and set lights with it’s position, type and other parameters for later use on dashboard. (± 50 lights depending on property size)

It’s working perfectly, but performance is issue even without shadows due to rectAreaLights. These are kinda essential there. I have not knowledge of lightmaps but I think that’s not an option because users does import their models and lights are controlled dynamicaly from dashboard (intensity, color…).

So I am about to fight with deffered rendering implementation by myself, so my question is does cost of rectAreaLights will be decreased, same as point and spot lights with shadows does?

As bonus → is there any chance to introduce shadows to rectAreaLights with DR?

* Edit *
After aimless wandering and toggling lights and experiencing lags, I noticed that it lags only when new combination of lights is turned ON.

For example:
I toggled one by one 4 light groups, each has 2-5 rectAreaLights in it and it took:

1. 2008ms
2. 2298ms
3. 9510ms
4. 22498ms

When I toggle them back to OFF in reversed order, and ON and OFF, it’s instant.

So I guess, as it’s written in other threads, it recompiles shaders every new combination that’s not saved in cache or in some other void. Does deffered rendering help with this also or it will always recompile too, just much faster?

you do not need rect area lights, just use an environment map. you can have have 20 million lights in there if you so desire.

and this is the kind of difference it makes:

From what I quickly researched (really quick search) EnvMaps isn’t suitable for my usecase. Correct me if I am wrong but EnvironmentMap does help me iluminate some model from background. Like in example to make illusion of lights in the tunel. But can’t make with it light of LED strip in kitchen.

If there Is a way to keep rectAreLights ( deffered rendering? ) and add shadows to it I would be glad. I have it allready fully implemented and I love the way it looks in every case I use them.

I’am using also spot and point lights for other light types, like ceiling lights. And I know I will have to make deffered rendering to be able to cast shadows with good performance. So it would be relief if it solves rectAreaLight too.

Example of what I need to achieve but for much less resources.

A few pre-baked lightmaps and aomaps will increase the realism (and will reduce the need to have so many lights).

Assuming that lightmaps are created from rendering the scene with that one light and then save it as texture for objects. I would need to iterate thought every object that is affected by the light and change texture right? And how about dynamic lights affecting it, does it work seamlessly ?

I thought about that but it would be usable only for switchable lights. For dimming or RGB lights it’s simply too much possible states to cover by lightmaps.

I might consider implementing it just and only for switchable lights because in example below it might come handy, because every yellow square has it’s own LED strip for this wine-rack.

But for example LED strips that goes around every room close to ceiling it isn’t good way because it is RGB controlled. I thought about cheating it by placing mesh where RGB strips are and put point light in center of room to illuminate it evenly. But still to make shadows for every spot and point light in scene I have to implement deffered rendering so that’s why I ask if DR helps to improve performance of RAL.

I tried ChatGPT to ask about three.js RAL and DR and it says that it will improve performance by calculating the RAL lights on GPU one by one. So I guess combination of lightmaps for switchable ligths to reduce number of dynamic RectAreaLights and deffered rendering for dynamically controlled lights with shadows might be good solution to keep desired functionality and good performance.

Although I will have hard time to implement it right, I think it’s possible and might be effective. I am just scared about these lightmaps loading dozens .jpg textures at once for all object affected by one light.