Using Light Layers and Volumetric Lighting in Unity’s HDRP

Yes you heard that correctly…Unity has a layering system for lighting! If you have an object that you want to receive lighting without that light source casting light on the entire environment, then you have come to the right place my friend!

Let’s get started by placing a spotlight outside where it’s nice and foggy. The amazing Area Lights will not currently work with this, but a spotlight or point light will do just fine.

Your light as well as your fog need to have volumetric features enabled. If you have already done this and you can’t see the fog in the light source, try increasing the value on the Volumetric Fog Distance.

You can see that as I increase the distance, the fog now appears more readily in the light and less in the environment.

Now the fog receives more light from the source, as would be true in a real life environment.

Changing the Temperature of the light source has a large impact on the fog itself.

You might notice some pixelation when moving the light around the scene.

Click the gear box icon on the Fog to reveal some additional options.

Now there are options for Slice Distribution, Quality and more.

Under Quality, feel free to change the default from Medium to High.

The Volumetric Fog Budget can have a big impact on overhead processing.

Because this is a scene demo and not an actual game yet, I am going to crank it up to the max value of 1.

Moving the light in the scene view looks a lot smoother.

The Game View shows a nice soft cone around the light where the fog is rolling in.

You can also play with Reprojection in your Project Settings.

I find leaving it active while also selecting it in the Denoising Mode works well for real time applications.

It’s time to move inside and work with some Light Layers. Here is a spotlight that I want to illuminate a lot of the volumetric fog at play.

Make sure that Light Layers is enabled in the HDRP Default Settings, under Project Settings.

The goal here is to illuminate the global fog without shining light on the rest of the environment.

Take a look a the light in the inspector and press the gear icon to drop down an additional option for the Light Layer.

There are a variety of layering options here for limiting your light source. I select the Nothing option, which apparently includes volumetric fog when enabled.

The Scene View now shows the fog being illuminated by the light while the rest of the environment is ignored.

Here you can see an expanded view of some of the layering options available for the Light Layers.

Now the spotlight captures all of the environmental fog in it’s path, without casting light on the test tube, or anything else.

The Radius on the spotlight can be increased to soften it’s impact on the fog closest to the light source.

Here is the Radius increasing in value.

The lights have been duplicated and mirrored in position to illuminate more of the fog in the scene.

If desired, the Filter option on the light source can be used to cast a color to whatever object you are illuminating.

Now we have some blue smoke without changing the color of the actual smoke!

Telling your lights to cast on a specific layer is only half of the battle, but how do you assign an object to the layer receiving light? The answer is through the Mesh Renderer of that object in the Inspector. Check out the Rendering Layer under the Additional Settings option.

Here you have an assortment of layering options when it comes to placing your object on the same layer as your light.

Now we have some soft lit volumetric fog with light sources that do not impact the environment. Thanks for reading!

--

--

--

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

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

Recommended from Medium

Thorough Introduction to Apache Kafka™

We All Have Misunderstandings About Clean Code

Serverless Applications: continuous delivery with AWS Lambda and API Gateway — Part 3: Managing API…

Interledger Rust Alpha Release

wilt/08.02.2017

Skaffold: How to work with multiple configs in one file aka modules

Introducing Jargon — Creating Releases and Importing Domains

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
Jared Amlin

Jared Amlin

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

More from Medium

Using Height Maps and Pixel Displacement in Unity3D

More Productive Editor Layout in Unity

Creating a Physics Based Character Controller in Unity

How to set a custom Skybox in Unity!