skip to Main Content

Using Volumetric Fog and Settings

Step 1) Right click in the Hierarchy panel and select “Effects” -> “Volumetric Fog & Mist 2” -> Fog Volume:

A Fog Volume is a boxed area that contains the fog effect.

Note: the first time a fog volume is added, a “Volumetric Fog Manager” gameobject is automatically created. This manager is responsible for finding point lights and void areas and send this data globally to all fog volumes.

Step 2) Create or assign a fog profile

A Fog Profile contains many appearance options and can be reused among fog volumes.

Click “New Fog Profile” or assign an existing profile.

Step 3) Position/scale/customize fog properties

Adjust the fog position and scale using the usual Transform component:

Customize the appearance of the fog changing the profile values:

Most profile settings are self-explanatory. Default values are recommended for most cases:

  • Raymarch Quality: represents the amount of samples used by the shader. A lower value uses less samples and improves performance.

  • Raymarch Min Step: increasing the minimum step size can contribute to improved performance.

  • Dithering: reduces banding artifacts when fog renders in front of solid surfaces.

  • Jittering: reduces banding artifacts on fog edges.

  • Noise Texture: you can use any other noise textures from the demo folders or use the Noise Generator tool (from Volumetric Fog Manager) to create a new noise texture.

  • Noise Strength: defines how noise affects fog shape.

  • Noise Scale / Final Multiplier: control the size and final amplitude of the noise.

  • Use Detail Noise / Detail Noise options: combines regular noise with additional 3D noise to create more compelling fog effect.

  • Detail Noise Texture: custom 3D noise texture (red channel is used only). You can find more noise and detail noise textures inside the demo folder.

  • Density: defines the sample density. Use a low value to create subtle mist while a high value produces a thicker fog.

  • Border: smooth fog volume edges.

  • Distance / Distance Fall Off: the distance at which the fog starts.

  • Distance Near Color / Far Color: tints the fog depening on the distance to camera. This feature only applies when Distance > 0. Use Distance Fall Off to customize the gradient. This option let you stylize the fog appearance based on distance.

  • Albedo: base color of the fog, including transparency.

  • Depth Gradient: when enabled, applies a color gradient to fog based on distance to camera.

  • Height Gradient: when enabled, applies a color gradient to fog based on height or distance to middle vertical position (fog is symmetrically rendered above and below the center of the volume).

  • Brightness: overall brightness of the fog.

  • Deep Obscurance: makes the fog darker at the middle of the fog volume.

  • Specular Color/Threshold/Intensity: simulates light speculars/reflections on the fog by the directional/main light.

  • Turbulence / Wind Direction: animates the fog along the time.

  • Use Day Night Cycle: when enabled, the fog light intensity and color will synchronize with the Moon and Sun (they must be assigned into Volumetric Fog Manager).
  • Light Diffusion Power/Intensity: controls the effect of the directional/main light when crossing through the fog in direction of the camera.

  • Receive Shadows / Shadow Intensity: controls shadows over the fog.

The Volumetric Fog Manager

  • The Volumetric Fog Manager gameobject is created automatically when at least one fog volume is added to the scene. This manager exposes common settings that affect all fog volumes in the scene, such as which is the main camera, the Sun light, the Moon (optional secondary directional light), etc:

General Settings

  • Main Camera: the asset will pick automatically the main camera but you can assign any other camera if you need that. This setting basically ensures the camera is correctly setup.

  • Sun: assign the main directional light here to produce day/night cycle lighting on the fog volumes automatically, based on the Sun rotation.

  • Moon: you can assign a secondary directional light that works as the Moon.

  • Fog Layer: specifies the default layer used by all fog volumes.

  • Flip Depth Texture: this setting counters a depth texture issue in old URP versions. Do not use if fog render correctly.

Custom Depth Pre-Pass

This option enables a custom depth pre-pass aimed to capture the depth of transparent objects or alpha clipping objects (objects that render in the transparent queue as well but that can have holes).

Final Composition

Use the Downscaling option to improve performance. The fog effects will be rendered to an off-screen buffer with a reduced size and then composed to the main camera target.

Use the Blur option to smooth the result, which can be used to reduce some jittering artifacts on native Unity lights like spotlights or shadows. Use it only if needed because this option introduces full screen blit passes which can be expensive on some devices.

Note: when using Custom Depth Pre-Pass, Downscaling or Blur Passes options, you need to add the appropriate render feature to the URP renderer. The inspector shows a button to select the current Pipeline asset. Click it:

Then, locate the Universal or Forward renderer asset:

And add the renderer feature to the list:

Shader Options

Click “Shader Options” button to list additional features like orthographic camera support and blue noise. Note that when these options are modified, the shader itself is updated so these options can only be changed inside Unity Editor, not in a build.

Managers

Provide access to the Point Light or Void Managers.

Tools

Access to the noise generator tool. Useful to create new 3D noise to be used in the fog volumes.

Back To Top