Control Lighting in Unity Using Light Layers

Thomas Mauro
3 min readSep 15, 2022

--

Light Layers are LayerMasks that can allow for a light source to only highlight a specific surface instead of it just illuminating everything it actually touches. This can also help with performance consolidation.

For this, I wanted to try to get a spotlight to only shine on the fog. So if it is pointing at something else with a surface I want those surfaces to be excluded from the light so that it will only highlight the actual fog.

  • Added a Spotlight and set it up for the testing purpose to point toward objects on the platform area

Right now the light will highlight anything it touches.

Now turn on Light Layers in HDRP.

  • Project Window/HDRP Pipeline Asset/Lighting/Check Light Layers Box

Back on the Spotlight go to its Inspector, find General.

  • On General Left-click the 3 dots and select Show Additional properties. This will activate the Light Layer option.

Here is what I did to set the spotlight to no longer shine on any of the objects and only illuminate the volumetric fog in the scene. You will see when I turn fog off of Global Volume the spotlight is gone. I lowed my Exposure and increased the Fog Attenuation for this.

  • Set the Spotlight Light Layer to Nothing then Light Layer 1 (For this I could technically set the layer to Nothing)

**Make sure to set the layer to Nothing before setting it to a layer that won't shine its light on objects in your scene you don't want it to shine on**

Dimmer Demo

So one thing it can be used for is to give that global volume for a bit of glow in certain areas you might want slightly highlights. Or use it to make one area seem to have more fog than another without using more fog.

--

--