Special Features

intermediate concepts

Dynamic Fog & Mist 2 (Built-in) · Features

Overview

Beyond the basic fog effect, Dynamic Fog & Mist 2 includes several specialized features: fog volumes for zone-based transitions, fog of war for strategy games, VR support, and gradient fog for artistic control.

Fog Volumes

Fog volumes let you define zones where fog properties automatically change when the player enters or exits.

Setup

  1. Go to GameObject > Create Other > Fog Volume.
  2. Position the volume and adjust the Collider bounds to cover the desired area.
  3. In the Inspector, configure:
    • Target Profile — a DynamicFogProfile ScriptableObject with the desired fog settings.
    • Target Fog Alpha / Sky Haze Alpha — opacity values inside the volume.
    • Target Fog Colors — color1 and color2 for the zone.
    • Transition Duration — how long (in seconds) the blend takes.
Tip: You can overlap multiple fog volumes. The last-entered volume takes priority.

Fog of War (Image Effect)

The image-effect fog of war lets you clear circular or rectangular areas of fog via scripting. This works with any camera perspective.

Setup

  1. Enable Fog of War in the DynamicFog inspector.
  2. Set the Center and Size of the fog-of-war region (default: centered at origin, 1024 x 1024).
  3. Adjust Texture Size to control the resolution of the transparency map (higher = more precise clearings).

Scripting

DynamicFog fog = DynamicFog.instance;

// Clear a circular area around the player
fog.SetFogOfWarAlpha(player.position, 10f, 0f);

// Clear a rectangular area
fog.SetFogOfWarAlpha(bounds, 0f, 0.5f);

// Query fog value at a position
float alpha = fog.GetFogOfWarAlpha(worldPosition);

// Reset all cleared areas
fog.ResetFogOfWar();

You can also create static fog-of-war holes: GameObject > Create Other > Dynamic Fog > Dynamic Fog of War Hole.

Fog of War (Dedicated Prefab)

For top-down perspectives, the dedicated FogOfWarLayer prefab provides better performance than the image-effect approach because it uses a mesh-based shader instead of a full-screen pass.

Setup

  1. Drag the FogOfWarLayer prefab from DynamicFog/Resources/Prefabs into your scene.
  2. Position the plane over the terrain or area to cover.
  3. Use the DynamicFogOfWar API:
DynamicFogOfWar fog = DynamicFogOfWar.instance;

// Optional: smooth cut along terrain edges
fog.SetFogWarTerrainBoundary(terrain, borderSize);

// Clear fog at a position
fog.SetFogOfWarAlpha(worldPosition, radius, alpha);

// Reset to fully opaque
fog.ResetFogOfWar();

// Control texture resolution
fog.fogOfWarTextureSize = 512;
Demo: See demo scenes 6 and 7 for complete fog-of-war examples.

VR & Single Pass Stereo Rendering

Dynamic Fog & Mist fully supports VR with Single Pass Stereo Rendering. It has been tested with Oculus and OpenVR SDKs.

SettingAction
Single Pass Stereo in Player SettingsEnable the Single Pass Stereo checkbox in the DynamicFog inspector (auto-detected from Player Settings — just verify it matches).
Multi-Pass StereoNo special configuration needed.

Gradient Fog

Dynamic Fog exposes two color selectors (Color and Color 2) that blend together to create artistic fog gradients. Use this to achieve sunrise/sunset fog transitions, eerie green-to-purple mist, or any custom color blend.

Next Steps

Was this page helpful?