Creating Fog and Using Particles in Unity3D and the URP
While Unity’s Universal Render Pipeline doesn’t offer the same volumetric fog as the High Definition Pipeline, you can still get some really nice looking fog using the particle system.
I am going to use a fog prefab from GameDevHQ’s asset library called Filebase. This asset uses Unity’s particle system alongside some smokey art assets to help upgrade the feel of this game environment.
To get started, I bring Filebase into my assets folder and then open it up inside Unity. Here I scroll through a variety of pre-made particles to import into my game scene. Once I find the Fog, I can download and install it. It is as easy as it sounds!
Now in the Assets folder, There is a GameDevHQ folder containing Filebase. Down in VFX>Particles>Environment, the prefab for the Fog can be found with it’s associated Material and Texture.
Simply drag and drop the fog prefab from the Assets folder into the Hierarchy.
The fog prefab can be moved into a desired position using the move tool.
You might see a moving red outline while the fog particle system animates. This can be disabled by selecting the drop-down arrow on the Gizmos, and then un-ticking the Selection Outline.
Now the fog animation can be viewed without the selection outline!
It is subtle and slow moving with my current settings, but here is a view from farther away. A little fog adds a lot of atmosphere!
This fog prefab is using a legacy shader, and I am using Unity 2020. I can select the Smoke material in the Assets folder, and then change the Shader to Universal Render Pipeline>Particles>Unlit.
If your fog suddenly becomes this pixelated disaster, fear not!
When updating the shader from the legacy version to the URP version, the Smoke Texture assignment was lost along the way. This is the image that will make the particles look like smoke!
Select the Smoke Material, and then drag the Smoke texture from the texture folder into the Base Map on the material to assign it.
The last thing to do before the smoke will appear again properly, is to change the Surface Type to Transparent.
There are a seemingly overwhelming amount of option when it comes to the particle system. I think the best way to get familiar with the particle system is really just to play with the controls and see how it reacts. For my purposes here, I will be increasing the values of the Start Speed slightly, as well as bumping up the Start Size a few notches to get more fog rolling!
Each of these options has a drop-down of it’s own with even more options to tweak. The rabbit hole goes deep when it comes to fine tuning a particle system for a specific look.
As for this article, I am happy with the simple slow fog movement as it adds some nice creepy atmosphere to the scene.
Please join me in my next article where I add reflections into the game scene. Thanks for reading!