Using Light Layers in Unity

Gabriel Perez
3 min readJan 25, 2022

A way to mask lighting on objects!

Light Layers are simply Layer Masks that occlude from casting light on meshes. They work well when you only want to use volumetric lighting on a light source, but not the light. It’s a feature only available to the HDR Pipeline.

Setup

If you haven’t installed High Definition Render Pipeline yet, go to Unity’s Documentation and read on how to set HDRP here!

We need a global volume fog for this to work. Go to: GameObject > Volume > Global Volume. Select the global volume game object, and in the inspector, click on “Add Override.” Enable the fog, and adjust the attenuation to your liking! Then enable Volumetric Fog.

Next, we need to enable the Light Layer property in our HDRP default asset file. In the project panel, select your HDRP asset file that is generated when creating a new render pipeline. In the inspector, under “Lighting,” click the box to enable “Light Layers.”

Next, let's create a spotlight.

Once created, with the spotlight selected, we need to click on the small gear to the right of the “General” tab in the inspector.

A Light Layer property will appear. Click on the dropdown and select Nothing first, then after, select Light Layer 1. The light will disappear, which is expected! Now we need to turn Volumetrics on in the spotlight.

We should see the spotlight casting a fog instead of a light. Although, it is too intense!

Let’s bring the multiplier down to 0.1 and also bring down the Emission’s intensity down to 285. We can also play around with the outer and inner angle of the cone.

It’s a neat feature to be able to use Light Layers for Volumetric lighting! You can create moody scenes when placed at the right spots!

Gabriel

--

--

Gabriel Perez

Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.