Using Fog and Volumetric Fog in the High Definition Render Pipeline in Unity
Objective: To create an eerie Fog Particle Effect for our Sci-Fi Lab in the HDRP in Unity.
It is time to add a cool fog effect into our Sci-Fi lab room to really build out the depth and experience the player is going to have walking into this eerie room.
Luckily I do have a fantastic fog prefab that I am able to import from Filebase to make life a bit easier. What is Filebase?
After importing the fog prefab into my Scene, I have made some minor adjustments to the ‘Particle System’ shown below which is really just the start speed and the start size.
Lastly, I am going to click on the material for the fog and set the Shader to be ‘Sprites/Default’ and change the tint of the colour to be a green closer to the colour of the test tubes.
Now we have our super cool fog feature!!!
Adding Volumetric Fog
Let’s take this one step further and introduce volumetric fog to a couple of point lights that are going to create this wispy fog effect around the light source. To get started let’s add a point light into our room, right click in the Hierarchy → Light → Point Light and move to where you would like it:
From here we need to have ‘Volumetrics’ enabled in the Inspector on the Point Light:
Add a Global Volume
We are also going to need to add a Post Processing effect so for the HDR pipeline let’s make sure we have our Global Volume setup. In the Hierarchy click on the ‘+’ symbol → Volume → Global Volume.
Let’s now create a new profile by pressing the ‘New’ button:
Now we are going to add our ‘Fog’ Post Processing effect. Press the ‘Add Override’ button → Fog. Then we are going to tick the ‘Enable’, ‘Fog Attenuation Distance’ and also ‘Volumetric Fog’.
Head back into your Scene view and you now see this wispy kind of fog effect that follows the point light around:
This is when the Volumetrics is enabled and disabled on the point light:
You can see the wispy fog surrounding the light.