Special Features
intermediate conceptsVolumetric 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
- In the menu, select GameObject > Create Other > Fog Volume.
- Position and scale the volume using its Transform.
- Configure the FogVolume component in the Inspector.
Fog Volume Properties
| Property | Description |
|---|---|
| Enable Profile Transition | Transitions all fog settings to the assigned Target Profile. |
| Enable Alpha Transition | Transitions fog transparency and sky haze alpha. |
| Enable Fog Color Transition | Transitions the fog albedo color. |
| Enable Fog Specular Transition | Transitions the specular color. |
| Enable Light Color Transition | Transitions the fog light color. |
| Transition Duration | Duration of the transition in seconds. |
| Target Collider | The collider that triggers the transition. Defaults to the camera collider. |
| Target Fog | The VolumetricFog instance to modify. Defaults to the camera fog. |
| Debug Mode | Prints 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.
| Property | Description |
|---|---|
| Layer Mask | Which layers are treated as ground (terrain, meshes, etc.). |
| Resolution | Size of the captured elevation texture. |
| Height Over Surface | Fog height above the ground level. |
| Min / Max Altitude | Clamps 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.
- Enable Fog of War in the Inspector and configure Center, Size and Texture resolution.
- Call
SetFogOfWarAlpha(position, radius, 0f)to clear fog (reveal area). - Call
ResetFogOfWar()to restore all fog. - 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.
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
- Open Shader Options and enable Fog Mask (Normal or Inverted mode).
- In the Geometry Mask section, select the Layer Mask containing your mask objects.
- Click Refresh to scan the scene.
- 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_XRSuggest an improvement
Help us improve this documentation page.