Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Optimize lighting in the Built-In Render Pipeline

Reduce extra lighting work so Unity uses fewer draw calls and processes fewer vertices and pixels.
Read time 2 minutesLast updated 17 days ago

Important
The Built-In Render Pipeline is deprecated and will be made obsolete in a future release.
It remains supported, including bug fixes and maintenance, through the full Unity 6.7 LTS lifecycle.
To optimize the lights in your scene, avoid Unity using multiple render passes to render GameObjects, or doing too much work to render lighting. This reduces the number of the draw calls the CPU sends, and the number of vertices and pixels the GPU processes.
Do the following:
  • Use lightmapping to light static objects, instead of realtime lights.
  • Avoid combining meshes if they're lit by different realtime per-pixel lights, because Unity calculates every light for every combined mesh.
  • Avoid lighting GameObjects with multiple per-pixel lights.

Prioritize lights

To avoid lighting GameObjects with multiple per-pixel lights, prioritize which lights provide per-pixel lighting based on which GameObjects they light.
For example, in a driving game, prioritize the car headlights as a per-pixel light, but deprioritize the rear lights and distant lampposts.
To decrease the number of per-pixel lights, do any of the following:
To increase the number of per-pixel lights, do any of the following:

Disable per-vertex and spherical harmonics (SH) lights

To disable per-vertex and SH lights in a custom shader, add the
OnlyDirectional
tag to the Pass in your ShaderLab code. For more information, refer to Pass tags in ShaderLab reference.

Additional resources