Setting Light Layers for Better Volumetric Environmental Lighting
Light Layers is an essential tool from Unity’s High Definition Render Pipeline that serves as filter to give each light source a layer (or list) of game objects to interact with. In this case, I will use a point light and spot lights to illuminate a fog area without showing reflections or illuminated areas on the near by game objects. This helps to brighten up the fog, making the scene look more alive without altering the reflections and brightness of other game objects, having a more controlled lighting.
To start, let’s enable the Light Layers setting inside the HDRenderPipelineAsset. Here we can manipulate the name of the different Light Layers as well.
To test this out, I added two spotlights to the Test Tubes area of the room, to illuminate the fog, currently the spot lights look as they normalize should, hitting everything on the map:
To implement the Light Layer, go to General Settings of the spot lights and click the gear-plus icon for more options. Light Layer parameter will appear and set it to Light Layer 1 or 2, so long Light Layer Default is not selected this will work.
Here’s a GIF of how toggling the default layer on and off look for difference reference:
With this layer filter we can see how the spot lights add volumetric value to the Fog without casting reflections onto the scene, saving some GPU power as well as controlling the desired colors for the environment much better. Now with the fog running:
And finally, toggling the spot lights on and off to see the final result being applied and without it:
This has definitely been one of my favorite topics with lighting and a huge field to keep exploring on.