This might be a question answered somewhere else but I’m not sure how to decrease the impact of the performance of my lights in game.
My lights are torches that get turned on/off and whose radius change. So if I understood correctly, that means I can only have them be dynamic lights.
If I turn off the generation of shadows from the lights, I get a good frame rate. Out of curiosity I tried the mixed lightmap baking but it didn’t not make a difference in terms of performance.
What can I do to reduce the impact on performance and still have shadows from those lights?
It’s for PC and consoles. I tested and the performance is only affected by the lights that are within the range of the camera, so there would be no point in disabling lights that are far away.
I maybe have max 8 lights per screen in my whole dungeon.
When I’m around all the lights in this GIF I have 20fps.
When I go in the dark I get max fps (60fps) https://i.imgur.com/jA2PS2r.gifv
I have set the shadow resolution to low and I don’t see any visual difference and my FPS is almost 60 now.
I guess the shadow textures were huge somehow. Would be nice if I could get their resolution even lower
It doesn’t look like my game could possibly have lags seeing as most meshes in my game are just simple boxes. I have to understand lighting more
This because of point light shadowing. Each point light draw scene 6 times to make a shadow map. So, if you have 8 point lights as on your GIF then you draw scene at least 48 + 1 times.
as you are using a top down perspective: you may replace some point lights by spot lights. not correct but way cheaper to render as a spotlight will render the scene only once.
yes. as @BattleAngelAlita already wrote: point light shadows force unity to render the scene 6 times when it comes to the shadow map as point lights use a cube map which has 6 sides. spot lights render the scene only once into a regular 2d texture.
Also torch are most static and close to a wall, a spotlight is the way to go, if you have a tech artist, the best way would probably to prebake shadow texture of the static environment, and only capture dynamic object proxy in the shadow pass, combine the two while resolving the shadow.