Objective: To highlight the Volumetric Fog in our Scene with a light source without illuminating the projected light onto surfaces.
I am wanting to accentuate or highlight the volumetric fog we created around the test tubes but I don’t want to use a light source that illuminates the surfaces it is splashing onto. This is where Light Layers come in…
What is a Light Layer
These are LayerMasks that only allow light to show up on specific surfaces. How this works is by setting Light Layers for lights and meshes so that meshes are only affected by lights with the correct Light Layer.
How to Get Light Layers Setup
Firstly, let’s start with adding a spot light to our Scene and projecting the cone of light coming from it towards the test tubes. Here you will see the volumetric fog lighting up but also illuminating the test tubes which we are trying to avoid:
Next step is to make sure that we have Light Layers enabled, so let’s go to our HDRP asset in the Project window → Lighting → Light Layers → Tick box.
Then going back to our spot light game object, we need to click on this tiny cog in the ‘General’ field in the Inspector. This is going to show a new field called ‘Light Layer’, which we are first going to set to ‘Nothing’ and then a Layer we know it won’t be cast on:
This is what should happen in your Scene view when you switch:
As you can see this accentuates or highlights the volumetric fog with some light but without the added illumination being projected onto the surfaces.
As I now move this light around the scene, you can see that there is no illumination on the surfaces the cone of light is projecting onto: