Hello,
I am using 2d light in my project. It’s working well and now I want to make some optimizations.
In my project I use a render texture to generate a kind of light map. In this way, when there is no light change, I do not recompute the lightmap. This part works well but now I want to be able to optimize the light map generation.
I was thinking I would be able to save performance for light by changing the render texture size. But it seems to have no impact…
Also I see that a draw call is made for each 2d light (and for each camera even if they use a different culling mask).
I suppose 2d light generates an internal mesh that is given to every camera without checking the culling mask and without batching them.
So my questions are:
-
Are we agree that with 3d light, reducing the render texture size will save performance of light too?
-
Do you have an idea on how to optimize it in 2d?
-
Is 2d light can use batching to reduce drawcall? and not be taked into account by every camera?
If needed this is what I have in my scene:
- many 2d lights using target sorting layer: “sLightMap”, the game object use the “LightMap” layer
- one sprite that use the same sorting layer “sLightMap”, the gameobjet use the “LightMap” layer
- a camera that use a render texture as output texture with culling mask using only “LightMap” layer
Thanks