Using Light Layers in Unity

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

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How We Secured Our AWS S3 URLs — Strategy & Implementation

Serverless Strapi v4 with Azure Container Instances (ACI)

6 Gotchas of Hibernate You Wish You Knew Earlier

An offline database — file archive

You’ll be blown away with these 12 cool things you can do with KnightSpear

Flutter vs React Native | Which one to choose in 2020

Jan 24: BOMB Shell Monday — xBOMB!

Player Progress Part 5

Provision K3S cluster on Macbook using K3D

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabriel Perez

Gabriel Perez

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

More from Medium

Layering Materials In Unity

P4: Creating a Gritty Office Den

Installing Probuilder In Unity

Cinemachine and Group Targets in Unity