Control Your Lighting in Unity Using Light Layers

Simon Pham
2 min readSep 4, 2023

--

Light sources are a valuable tool in Unity for illuminating your scenes and enhancing their visual appeal. However, excessive use of light sources can negatively impact your video game’s performance. In some cases, you may only require volumetric fog rays, which is where Light Layers in HDRP come into play.

What is a Light Layer?

A Light Layer is an approach that allows you to configure a light source to cast illumination only on specific objects within particular layers. This is particularly useful for optimizing your scenes and achieving volumetric effects.

How do we achieve this?

Let’s begin by creating a Spot Light that casts its light on the test tubes. Increase the Intensity to 10,000 Lumens, change the color to yellow to match our theme, and adjust some other properties until you’re happy with it.

You can see that the Spot Light is illuminating the test tubes, which is not the desired effect. To enable Light Layers, select the Spot Light and go to the General section. Click on the three-dot icon and choose “Show Additional Properties”.

Next, from the Light Layer dropdown list, select “Nothing,” and then choose “Light Layer 1”.

Now, you can clearly see that the tubes are no longer being illuminated.

Next, duplicate the Spot Light and position it on the opposite side of the first one.

Voila! That’s how you use Light Layers in Unity HDRP.

--

--

No responses yet