Lightmapping Troubleshooting Guide

Chapter 6: Lights flicker or disappear


Figure 12. Pixel Light Count set to 0 (left). Pixel Light Count set to 9 (right). Notice that the realtime shadows and specular highlights are missing completely in the image on the left.

6.1 Why does this happen?
When using the forward rendering path, Unity converts pixel lights to more performant vertex lights. It happens when the number of pixel lights exceeds a certain value. This can result in flickering or disappearing lights when navigating the scene.

This limitation affects Built-in and Universal render pipelines only – HDRP is not affected.

6.2 How to fix it?
6.2.1 Adjust pixel light count property


Figure 13. Project Settings window in the Built-in render pipeline (left). URP asset (right). We highlighted properties which increase the pixel light limit.

It is possible to increase the number of pixel lights Unity renders before converting pixel lights to vertex lights. Here is how to do this:

  • In the Built-in render pipeline, navigate to Project Settings > Quality > Rendering and adjust the Pixel Light Count property.
  • In URP, select the Render Pipeline Asset, and navigate to Lighting > Additional Lights. Make sure that the dropdown is set to Per Pixel and adjust the Per Object Limit property.

Keep in mind that increasing the above-mentioned values will result in extra draw calls.

6.2.2 Adjust Render Mode property


Figure 14. Light component in URP.

For lights of high importance, set the Render Mode dropdown in the Light component to Important. This will reduce the probability of Unity converting said light to a vertex light.

When Render Mode is set to Auto, Unity will check the light’s intensity and its relative distance from the camera before converting it.

Lights which have Render Mode set to Not Important will always revert to vertex lights.

6.2.3 Switch rendering paths
If you need many mixed or realtime lights in the scene, consider switching to a deferred rendering path. Here is how to do this:

  • In the Built-in render pipeline, navigate to Project Settings > Graphics. Under Tier Settings, uncheck the Use Defaults checkbox for the tier of your choosing. Set the Rendering Path dropdown to Deferred.
  • In URP, select the Render Pipeline Asset. Under the Rendering header, set the Rendering Path to Deferred.

6.2.4 Switch to baked lights
The easiest and most performant way to mitigate pixel light limitations is by switching to baked lights. To do so, set the Mode dropdown in the Light component to Baked.

3 Likes