unity-game-engineoptimizationgame-developmentvirtualizationdirectional-light

How to optimize lights in Unity


I'm building a virtual exhibition platform in unity. There are about 50 stalls and I used a directional light and 124 point lights light up the scene. I didn't use any real time lighting, only baked lighting is used. But at runtime frames get dropped. when I inactivate all pointlights it works smoothly. How can I optimize lights?

enter image description here


Solution

  • You can improve your performance by doing the following,

    1. Add Light Probes, this can minimize the number of point lights in use.
    2. Change Render Mode to Auto, this will reduce the load significantly in your case as there are a lot of point lights in use.
    3. Apply a culling mask, make sure the light affects only the required object in the stall.
    4. Use Fake Shadow instead of using Soft Shadow.
    5. Switch to URP or HDRP.

    Alternate way : Build and bake each stall separately in Blender or Maya. Then add them to unity. This way you don't need to add that many point lights and bake.