Special Features

intermediate concepts

Dynamic Fog & Mist 2 (URP) · Core Concepts

Sub-Volumes

A sub-volume is a localized area where fog transitions to a different profile. When the fade controller (typically the camera or player) enters a sub-volume, the fog smoothly blends from the main profile to the sub-volume’s profile.

When to use sub-volumes

  • A general fog covers your entire level, but you want different colors or density in a cave or interior.
  • You want fog to change mood when the player enters a specific zone (e.g., swamp, forest).

Creating a sub-volume

  1. In the Hierarchy, right-click and choose Effects > Dynamic Fog 2 > Fog Sub-Volume.
  2. Position and scale the sub-volume to cover the desired area.
  3. Assign a Profile with the desired fog settings.
  4. Set the Fade Distance to control how smoothly the transition happens.
Creating a Dynamic Fog sub-volume in the Hierarchy Sub-volume profile and fade distance settings

How blending works

When the fade controller enters a sub-volume, the fog profile blends linearly based on distance to the nearest face of the sub-volume collider. At the boundary edge, the blend factor is 0 (fully main profile). At a distance equal to Fade Distance inside the boundary, the blend factor reaches 1 (fully sub-volume profile).

All profile properties are blended during the transition: density, colors, altitude, noise, light diffusion, and rendering settings. Boolean properties (like Depth Clip, Use XYZ Distance, Use Vertical Gradient) switch at the 50% blend point.

Tips for smooth transitions

  • Make the sub-volume larger than the actual target area (e.g., extend it beyond doorways and corridors) so the player spends more time inside the fade zone before reaching the center.
  • Use a larger Fade Distance value (5-10+ depending on your scene scale). Small values produce abrupt transitions because the blend zone is very narrow.
  • The transition speed depends on which face the player enters from. Entering near a corner feels faster because you are close to multiple faces at once.
  • If the sub-volume is placed so that the player enters through a narrow axis (e.g., a vertical ladder), consider extending the sub-volume along that axis to widen the fade zone.

Multiple overlapping sub-volumes

When multiple sub-volumes overlap, they are blended sequentially. The first sub-volume blends with the main profile, then the next sub-volume blends with the result, and so on. This allows layering different fog effects in the same area.

Fog of War

The fog of war system uses a 2D texture to control fog opacity across the game world. This is commonly used to reveal explored areas or show which zones are visible to the player.

Fog of war overview showing clear and fogged areas

Configuration

ParameterDescription
World Center / CoverageMaps the fog of war texture to the world using a center position and coverage size.
Texture SizeResolution of the fog of war texture. Larger textures allow finer detail but use more memory.
Restore DelaySeconds before cleared fog starts restoring. Set to 0 to prevent automatic restoration.
Restore DurationTime for fog to fully restore after the delay. Set to 0 for instant change.
Border SmoothnessControls edge softness of cleared areas.
BlurProduces a softer transition between clear and opaque fog areas.

Fog of War Editor

Enable the Fog of War Editor to interactively paint or erase fog directly in the Scene view.

Fog of War Editor with paint and erase tools
  1. Click Create new Mask Texture to create the asset that stores fog opacity data.
  2. Choose a Brush Mode (paint or erase).
  3. Adjust Width, Fuzziness and Opacity for artistic control.
  4. Click and drag in the Scene view to paint fog areas.

Orthographic Camera Support

Dynamic Fog supports orthographic cameras. To enable this, locate CommonsURP.hlsl in the package files and uncomment the following line:

#define ORTHO_SUPPORT
Why is this not enabled by default? The orthographic projection code path adds a small overhead. Uncommenting this line only when needed keeps the shader as lean as possible for perspective cameras.

Transparency Support

Customizing rendering order

Each Dynamic Fog volume has its own Render Queue setting in the Rendering section of the component. This lets you control whether fog renders before or after specific transparent objects.

Render queue settings for fog volume

Working with transparent objects

The fog effect relies on the depth buffer for ray-marching distance calculations. Because transparent objects (water, glass, particles) do not write to the depth buffer, the fog may render on top of them regardless of their position.

Solutions:

  1. Adjust render queue — set the fog volume’s render queue to render after specific transparent objects.
  2. Layer-based exclusion — use sorting layers to separate fog from transparent geometry.
Was this page helpful?