Tips and tricks on working with the long-awaited Volumetric Fog in Unreal Engine 4.16.
To control Volumetric Fog, you can adjust the properties in your Exponential Height Fog and on each light to control the light’s contribution amount.
Volumetric Fog controls can be found in the Exponential Height Fog component under the Volumetric Fog section. The exponential height distribution provides a global density for Volumetric Fog.
Scattering Distribution
This determines how directional the volumetric scattering is; a value of 0, means light scatters equally in all directions, while a value close to 1 causes scattering predominantly in the direction of the light (you have to be looking at the light to see its scattering).
Albedo
This is the overall reflectiveness of the participating media. Clouds, fog, and mist, which are based on water particles, have an Albedo close to 1.
Extinction Scale
Controls how much the participating media blocks light.
View Distance
The distance from the camera over which Volumetric Fog will be computed. There are a limited number of Z slices in the volume texture, so pushing out the View Distance will increase under-sampling artifacts near the camera.
Override Light Colors with Fog Inscattering Colors
When enabled, uses the Fog Inscattering Color, Directional Inscattering Color, and Inscattering Texture properties to override the light color with Volumetric Fog.
Each light’s contribution amount to the scene and whether it shadows the fog can be controlled using the following properties.
Volumetric Scattering Intensity
Controls how much this light will contribute to the Volumetric Fog. When set to 0 there is no contribution.
Cast Volumetric Shadow
Whether to cast a volumetric shadow for lights contributing to Volumetric Fog. When enabled, Point and Spot lights are ~3x more expensive than non-shadow casting lights.
The Spot light’s contribution to the Volumetric Fog has been disabled by setting the Volumetric Scattering Intensity to 0.
Materials using the Volume domain describe Albedo, Emissive, and Extinction for a given point in space. Albedo is in the range [0-1] while Emissive and Extinction are world space densities with any value greater than 0.
Volume materials currently only work on particles and only positions inside of the particle radius are valid, which is usually handled by a SphereMask.
Placing a single Particle System with the material causes a sphere of density to be added to the Volumetric Fog. The effect is fully 3D with no billboards involved.
Taking this approach a step further, you could use multiple spherical fog particle with noise from textures to limit fog to a certain area of your scene.
The volume textures used by Volumetric Fog are relatively low-resolution and aligned to the camera frustum. Volumetric Fog uses a heavy temporal reprojection filter with a different sub-voxel jitter each frame to smooth out the aliasing. As a side-effect, fast-changing lights like flashlights and muzzle flashes leave lighting trails. Disable the contribution of these lights by setting Volumetric Scattering Intensity set to 0.
The GPU cost of Volumetric Fog is primarily controlled by the volume texture resolution, which is set from the Engine Shadow Scalability level. Volumetric Fog costs 1ms on PlayStation 4 at High Settings, and 3ms on an Nvidia 970 GTX on Epic settings, which has 8x more voxels to operate on.
profilegpu
to inspect this cost.This list comprises the currently supported features of Volumetric Fog:
Also, translucency is properly affected by Volumetric Fog, depending on its position in the scene. By default, translucency computes fog at vertices, so water planes with low tessellation can introduce artifacts. These materials can be set to compute fogging per-pixel to solve this with Compute Fog Per-Pixel enabled in the Material Details.
The following features are not yet supported while using Volumetric Fog:
You can find more details on working with volumetric fog here.