Environmental Fog is one of those cool effects that almost every game that can use it almost always does. It almost feels like instant immersion in a can but how do you get those spooky vibes in your own game. Well read below and we’ll go over how you setup environmental fog in HDRP.
Let’s start by adding a Global Volume to the Hierarchy, you can find that by going Right-Click>Volume>Global Volume
With the Global Volume added then add an Override for (as you guessed) Fog. It should look like this.
Now with the Fog settings available you can tweak the values to your liking. I’m going for a low clinging fog so I’m changing it so that hazy ambient sort of fog using a constant color rather than on based on the sky as this is an indoor scene.
After playing around with the Fog Attenuation (how dense the fog is based on distance in meters) and Base Height (where the fog starts from the ground level) I was able to produce something like below. It is important to remember that much these effects rely on tweaking values until you start getting the desired effect. It can be daunting but just moving the values around and changing the color can do wonders for the type of scene you’re setting.
Next we’ll create a low-hanging fog creeps along the floor using Unity Particle System. Start by picking up a smoke particle over at Open Game Art by Fupi (here) and importing it into your project, I went with Smoke 1 but they’re all pretty good. Create a new material using the settings like the one below using the HDRP>Lit shader. Add the texture to the Base Map and make sure the transparency is turned down.
Next we’ll create a particle system in the Hierarchy, you can do that easy by Right-Click>Effects>Particle System and it will spawn one in the scene. Below are the settings I used. Be sure to drag the Material into the slow under Rendering as shown below my settings.
With these settings you should get something very similar to this effect. If you don’t make sure to properly review the settings above. Don’t be disheartened if it doesn’t come out perfect, just keep adjusting values until you like the results.
These particle systems are often more art than science, feel free to tweak the values (and save often!) to get the desired effect. As you can see a little fog goes a long way to transforming your scenes and making them ooze with style. When paired with the fidelity of the HDR pipeline you can get some truly slick environmental effects. Until next time, happy coding.