How to add Fog in Unity? Things you must know.

Looking to add fog to your scene? Fog is a great post processing effect that you can use in your game. But it has its limitations. In this tutorial, we will see how to add fog to your scene and also the Pros and Cons of Fog.

Adding Fog based on Camera depth

  1. Go to Window>Rendering>Lighting.
  2. Select the environment tab.
  3. Go to other settings.
  4. Check the Fog check box.
Lighting window in Unity

Now you should see Fog in your game scene.

It’s that easy but there are some issues with this

  1. Fog is a little buggy with URP. You need to play around with the settings to get the right fog.
  2. Fog is based on camera depth. If you need a particular place to be covered with fog then you have to use volumetric fog.

Here is how the basic fog in Unity looks like

Free Unity asset banner

Game scene comparison with fog and no fog

Adding volumetric fog in Unity

Volumetric fog is not supported in URP out of the box. You will need to create fog using particles which we will cover in a different post. If you are using HDRP you can add volumetric fog with the steps below. Read more on URP vs HDRP.

  1. Add a Sky and Fog volume object to your scene.
  2. Add a collider to the game object to define the boundaries.
  3. Set the mode to local in the volume properties if you want fog in a localized area.
  4. Scroll down to the Fog component and check the Volumetric fog.
  5. Set the color and distance.
  6. Set the blend distance to tell Unity when the fog should start affecting the camera.

That’s it your volumetric fog is ready.

Fog setting in HDRP

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.