Shedding some light on the Universal Render Pipeline for Unity 2021 LTS

Posted by

In the Lighting section of the URP Asset, you can change the settings for both the Main Light and Additional Lights. The Main Light is the most significant Directional light in your scene. Additional Lights are the remaining Directional, Spot, and Point lights. While a scene can include a large number of these lights, there is a general limit to the number onscreen and a Per Object Limit for the Forward Renderer path.

The Main Light is either the light you designate as the Sun Source in the scene’s Lighting Settings (Window > Rendering > Lighting > Environment) or the brightest real-time Directional light. In practice, this is usually the brightest Directional light with a Render Mode set to Auto or Important, and a Mode set to Mixed or Real-time.

Unity bases the brightness of Directional lights that use the Render Mode option Important or Auto on the Grayscale value of their Color, multiplied by the light’s Intensity, with a modifier for shadowing lights:
(Red x 0.3 + Green x 0.59 + Blue x 0.11) x Intensity x Modifier

If you only have Not Important Directional lights in your scene, then URP compares light Intensity values to determine the Main Light. But seeing as Unity applies a modifier to shadowing lights, it might choose a dimmer light over a brighter one if the dimmer light has Cast Shadows active.

In the Lighting section, you can assign the Atlas size for both the Main Light and Additional Lights’ shadows. For the Main Light, this setting affects the Atlas URP that it uses for Cascade Shadows, with settings in the Shadows section of the URP Asset. In the Additional Lights section, you can set the Shadow Resolution tiers. URP attempts to fit all the visible lights with shadows into the Atlas based on their resolution (Custom, High, Medium, or Low).

However, if the size that URP requires to render these shadows at your preferred resolution is larger than the Atlas, URP scales down the shadows or potentially removes them altogether. This occurs if there isn’t enough space for the minimum possible light resolution (8×8 for Hard Shadows and 16×16 for Soft Shadows) or if you’ve hit a hardware limitation (on mobile). This means the quality of shadows from punctual lights can drastically change when you have a large number of lights visible or when a small number of lights take up a decent portion of the Atlas (i.e., Point lights require more space, six slices, on the Atlas).