Fog Manager & Performance
intermediate conceptsVolumetric Fog & Mist 3 · Core Concepts
The Fog Manager holds the settings shared by every fog volume: the quality and the cost of the fog. It is optional: with no manager in the scene, the default values apply. Create one with GameObject > Effects > Volumetric Fog & Mist 3 > Fog Manager, or with the button at the end of the fog volume inspector.
Settings
| Setting | Description |
|---|---|
| Main Manager | Enable this option to choose this manager when other managers are loaded from other scenes. |
| Performance Level | Limits the cost of the fog. See below. |
| Downscaling | The fog is rendered at the screen size divided by this value. Higher values are faster and show less detail. |
| Min Buffer Height | Smallest height in pixels at which the fog is rendered, so Downscaling does not remove too much detail on small screens. |
| Temporal | Blends the fog with the fog of the previous frames to remove noise. Fast changes of the fog can leave a short trail. |
| Temporal Upscale | Renders one of every four fog pixels per frame and completes the picture with the previous frames. It is much faster; the fog takes a moment to get sharp after the camera stops. |
| Temporal Blend | How much the previous frames count. Higher values remove more noise and react slower to changes. |
| Transparent Support | The fog is also drawn over the transparent objects that use a compatible shader, such as glass or particles. It uses more memory and time. |
Performance Level
The Performance Level limits the settings of every fog volume without changing them: a setting over the limit of the level is drawn with the value of the level. Use it to offer quality options to your players. Custom uses the settings as they are.
| Limit | High | Balanced | Low |
|---|---|---|---|
| Raymarch Steps | 96 | 48 | 32 |
| Light Steps | 4 | 4 | 2 |
| Haze Steps | 8 | 4 | 4 |
| Native Light Steps | 4 | 1 | 1 |
| Min Buffer Height | 900 | 720 | 540 |
| Simulation Resolution | 512 | 256 | 128 |
| Simulation Fog Resolution | 1024 | 512 | 256 |
| Pressure Steps | 20 | 12 | 8 |
| Detail Noise Strength and Strands | On | On | Off |
When a level limits a setting, the fog volume inspector shows a note under that setting.
FluidFogManager manager = FluidFogManager.GetManagerIfExists();
if (manager != null) manager.performanceLevel = PerformanceLevel.Balanced;
Transparent Support
Transparent objects are drawn after the fog, so by default they show without fog in front of them. With Transparent Support on, shaders that include the Volumetric Fog & Mist 3 function show the fog that is between the camera and the object.
To make a hand-written URP shader compatible, include the file and apply the fog to the final color in the fragment shader:
#include "Assets/FluidFog/Resources/Shaders/FluidFogTransparent.hlsl"
// in the fragment shader
float2 screenUV = GetNormalizedScreenSpaceUV(input.positionCS);
float eyeDepth = -TransformWorldToView(input.positionWS).z;
color.rgb = ApplyFluidFog(color.rgb, screenUV, eyeDepth);
The demo shader FluidFog/Demo/Transparent in Assets/FluidFog/Demo/Shaders is a complete example. The file also has GetFluidFog, which returns the light of the fog in rgb and its opacity in alpha, and GetFluidFogVisibility.
In VR with Single Pass Instanced rendering, Transparent Support stays off.
Performance Tips
- Keep Temporal Upscale on. It is the biggest saving.
- Use Performance Level Balanced or Low on slower hardware.
- Lower Raymarch Steps and raise Raymarch Step Growth for fog that is seen from far away.
- Keep Light Volume on.
- Set Haze Density to 0 if you do not need the haze.
- Set Native Light Steps to 0 if the fog does not need to hide the lights behind it, or turn off native lights when the scene has no point or spot lights in the fog.
- Use a smaller Area Size and Resolution in the fluid simulation.
- Leave Transparent Support off if no transparent object needs the fog.
Suggest an improvement
Help us improve this documentation page.