Optimize Fog in Unity’s HDRP
When adding volumetric lights with fog, you may have some issues with the fog’s appearance, such as pixelated or blotchy deformities. This is often caused by how default parameters are set in the Inspector and are very simple to correct.
Note: If you want to learn how to add Volumetric Lights with fog, check out the article below! Some of the concepts in this article assume you know how to create this.
Adding Volumetric Lights with Fog
Objective: A brief look at what volumetric lighting is, and how to add lights with volumetric fog in Unity HDRP.
Objective: Today you will learn how to set parameters and options to optimize the appearance of fog in Unity HDRP.
Optimizing Fog in Unity
Here is our flawed volumetric light with fog. It might not be too noticeable at first glance, but as you look toward the cone's origin(the thinner side) you can see how it looks more blotchy.
It almost looks pixelated.
How do we fix it?
- For starters, we can start by tweaking the quality of your fog in your Global Volume.
As soon as you change it to high quality, you will notice an instant improvement.
2. For this next part you will need to Show Additional Properties on your Fog parameter.
This will give you access to the Slice Distribution Uniformity.
The official Unity Manual defines this property as follows:
But I would like to rephrase it to a more manageable term for the sake of this example. You can think of this value as something that controls slices that regulate the flow of your fog. The closer your values are to 1, the more clumps you will have, and the closer it is to 0, the more organic and uniform the distribution of that flow will be.
3. For the final fix of this article, go to Edit → Project Settings and HDRP Global Settings →Lighting.
In your Lighting tab make sure to uncheck the Reprojection box. By doing this, it can help you prevent certain problems at run time like a ghosting effect when your light is in movement. Ghosting effects are when your light leaves a faded trail behind as it moves instead of flowing naturally.
I hope you have found this information valuable! Follow me for more Unity Development articles! :) I am a video game narrative designer on a journey to learn more about Unity Development and Software Engineering.