In this lesson, you will learn how to leverage Volumetric Fog to simulate the light-scattering physics that naturally define depth and scale in vast outdoor environments.
While basic height fog simply fades pixels based on distance, Volumetric Fog treats your scene like a physical medium. It populates the 3D space with a grid of voxels, allowing light to scatter off particles and create "God Rays" (volumetric light shafts) and distinct atmospheric perspective. This is crucial for large-scale worlds, as it reinforces the illusion that distant mountains are physically further away because more light-scattering air exists between the camera and the object.
To get started, ensure you have an Exponential Height Fog component in your scene and check the Volumetric Fog box. The magic happens when you adjust the View Distance and Scattering Distribution.
Controlling Light Scattering
The Scattering Distribution parameter (anisotropy) dictates how light behaves when hitting fog particles. A value of 0 creates isotropic scattering (uniform light), while higher values (closer to 0.9) create "forward scattering," mimicking real-world conditions where light brightens significantly when looking toward the sun.
You can also use a Volumetric Fog Material to create density variations, but for depth perception, focus on the Fog Density and Height Falloff:
// Within your Post Process Volume or Height Fog settings,
// these properties drive depth perception:
FogDensity = 0.02f; // Base thickness
HeightFalloff = 0.2f; // How quickly the fog thins as altitude increases
VolumetricFogDistance = 5000.0f; // Limit the voxel grid calculation for performance
Depth Perception Through Lighting
For the most effective depth, utilize Light Components (Directional or Point Lights) with Atmosphere & Fog Sunlight enabled. Because volumetric fog is shadow-aware, it creates localized shafts of light that are occluded by your world geometry. When these shafts intersect with distant peaks, they provide the visual "parallax" cues that help players perceive true scale. If you notice banding in your light shafts, increase the Volumetric Fog Grid Pixel Size in your project settings, though keep an eye on your performance budget.
Key Takeaway: Volumetric Fog transforms flat, distant geometry into a depth-rich landscape by simulating light scattering through a 3D voxel grid, grounded by shadow-casting light sources.