Starting this thread for feedback and discussion about the new 4.16 Volumetric Fog feature.
Full feature description:
We now have support for Volumetric Fog. This method computes participating media density and lighting at every point in the camera frustum, so we can support varying densities and any number of lights affecting the fog.
Volumetric Fog supports lighting from:
- A single Directional Light, with shadowing from Cascaded Shadow Maps or static shadowing, with a Light Function
- Any number of point and spot lights, with dynamic or static shadowing if ‘Cast Volumetric Shadow’ is enabled.
- A single skylight, with shadowing from Distance Field Ambient Occlusion if enabled
- Particle lights, if ‘Volumetric Scattering Intensity’ is greater than 0
Not currently supported:
- Precomputed global illumination
- Shadowing of Stationary skylights
- IES profiles and Light Functions on point and spot lights
- Shadowing from Ray Traced Distance Field Shadows
- Shadowing from the volumetric fog itself
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’.
Volumetric Fog controls are on the Exponential Height Fog Component. The exponential height distribution provides a global density for Volumetric Fog.
Scattering Distribution 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 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 is 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.
Note that Volumetric Fog can’t really match the Exponential Height Fog in the distance, as Volumetric Fog is physically based while Exponential Height Fog is not. Properties like StartDistance, FogMaxOpacity and FogCutoffDistance don’t affect Volumetric Fog.
Each light has a ‘Volumetric Scattering Intensity’ and ‘Cast Volumetric Shadow’ setting.
Materials using the new 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 the particle radius are valid, which is usually handled by a SphereMask. The simplest Volume material for a particle system looks like this:
Placing a single-particle system with that material causes a sphere of density to be added to the Volumetric Fog. The effect is fully 3d with no billboards involved.
Multiple spherical fog particles with noise from textures can be used to limit fog to a certain area.
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 volumetric fog contribution on these lights with ‘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.
Particles using the Volume domain can add significant GPU cost, depending on their 3d overdraw and instruction count. Use ‘profilegpu’ to inspect this cost.
Point and Spot lights which have ‘Cast Volumetric Shadow’ enabled cost ~3x more than unshadowed Point and Spot lights.