Special Features

intermediate concepts

Volumetric Fog & Mist (Built-in) · Core Concepts

Special Features

This page explains the advanced features of Volumetric Fog & Mist 2 for the Built-in Render Pipeline. Each section covers a specific capability with usage instructions.

Fog Profiles

Profiles are ScriptableObject assets that store all fog settings. They allow you to save, share and swap fog configurations easily.

  • Create — saves a new profile from current settings.
  • Revert — reloads the profile, discarding Inspector changes.
  • Update — writes current Inspector values back to the profile asset.

Sample profiles are included in VolumetricFog/Resources/Profiles. Assign any profile to the Profile slot to load its settings instantly.

Fog Volumes

Fog Volumes are trigger zones that automatically transition fog properties when a collider enters or exits them.

Creating a Fog Volume

  1. In the menu, select GameObject > Create Other > Fog Volume.
  2. Position and scale the volume using its Transform.
  3. Configure the FogVolume component in the Inspector.

Fog Volume Properties

PropertyDescription
Enable Profile TransitionTransitions all fog settings to the assigned Target Profile.
Enable Alpha TransitionTransitions fog transparency and sky haze alpha.
Enable Fog Color TransitionTransitions the fog albedo color.
Enable Fog Specular TransitionTransitions the specular color.
Enable Light Color TransitionTransitions the fog light color.
Transition DurationDuration of the transition in seconds.
Target ColliderThe collider that triggers the transition. Defaults to the camera collider.
Target FogThe VolumetricFog instance to modify. Defaults to the camera fog.
Debug ModePrints enter/exit messages to the Console.

See Demo Scene #7 "MountainClimb" for a working example.

Fog Areas

Fog Areas restrict fog rendering to a box or sphere container, allowing localized fog effects.

Method 1: Inspector

Use the Fog Area section on the VolumetricFog Inspector to set position, shape, radius and falloff.

Method 2: Prefabs

Drag FogBoxArea or FogSphereArea prefabs from VolumetricFog/Resources/Prefab into the scene. Use Transform position and scale to size the area.

Method 3: Script

Call fog.CreateFogArea() at runtime. See Demo Scene #10 for examples.

Sorting

Fog areas are rendered back-to-front by default. Alternative sorting: Altitude (height relative to camera) or Fixed (manual render order value).

Terrain Fit

The Terrain Fit option adjusts fog to follow the ground surface, creating effects that flow over hills and valleys. Available in Fog Areas only.

PropertyDescription
Layer MaskWhich layers are treated as ground (terrain, meshes, etc.).
ResolutionSize of the captured elevation texture.
Height Over SurfaceFog height above the ground level.
Min / Max AltitudeClamps the rendered fog altitude range.

Elevated Fog & Clouds

Set Base Height above the camera Y position to render floating fog layers or cloud effects. Increase Max Distance beyond the camera far clip plane to extend clouds to the horizon.

See Demo Scene #7 "MountainClimb" for a dynamic cloud layer example.

Fog Void

Creates a clear area in the fog around a world position. Ideal for third-person games where the character needs visibility.

  • Spherical void — set the Radius slider.
  • Box void — set Width and Depth sliders.
  • Assign a Follow GameObject (e.g., player character) for automatic tracking.

Fog of War

Fog of War reveals or hides fog areas dynamically at runtime with per-pixel control.

  1. Enable Fog of War in the Inspector and configure Center, Size and Texture resolution.
  2. Call SetFogOfWarAlpha(position, radius, 0f) to clear fog (reveal area).
  3. Call ResetFogOfWar() to restore all fog.
  4. Set Restore Delay to 0 for permanent cuts, or a positive value for auto-restore.

You can also place Fog Of War Hole game objects via Hierarchy > Create Other > Volumetric Fog > Fog of War Hole. Use Transform position and scale to size the hole.

Important: Fog of War requires geometry under the fog that writes to the Z-buffer (terrain, opaque meshes). Transparent shaders will not work.

Light Scattering (God Rays)

Screen-space light scattering that creates shafts of light from the sun. Requires a Sun to be assigned. The effect is only visible when facing the sun.

  • Light Diffusion — lightweight coloring around the sun (low GPU cost).
  • Sun Shafts — occlusion-based light shafts that interact with scene geometry (higher GPU cost).

Sun Shadows

Casts directional light shadows over the fog. By default uses Unity's shadow map. Disable "Native Directional Shadows" in Shader Options to use a custom shadow pass with per-object control and cookie support.

The Shadow Cancellation slider controls fog alpha under shadows. At 1.0, only sun-lit fog renders, producing a volumetric light effect.

Depth Blur

Blurs the color buffer before overlaying the fog, simulating additional light scattering. Experiment with different depth values to find the right look.

Geometry Mask

Uses mesh volumes to define complex fog boundaries. Unlike Fog Areas (one container per effect), Geometry Masks can combine any number of mesh objects.

Setup

  1. Open Shader Options and enable Fog Mask (Normal or Inverted mode).
  2. In the Geometry Mask section, select the Layer Mask containing your mask objects.
  3. Click Refresh to scan the scene.
  4. Disable the MeshRenderer on each mask object (they only provide geometry).

Orthographic Camera

To enable orthographic camera support, edit VolumetricFog/Resources/Shaders/VolumetricFogOptions.cginc and change:

#define FOG_ORTHO 1

VR & Single-Pass Stereo

Fully compatible with VR using both Multi-Pass and Single-Pass Stereo Rendering. The VR mode is detected automatically from Player Settings.

To disable XR support, comment out the macro in VolumetricFog.cs:

//#define ENABLE_XR
Was this page helpful?