A Cheat Sheet on Volumetric Fog in UE4
Events
Subscribe:  iCal  |  Google Calendar
Las Vegas US   8, Jan — 12, Jan
Zürich CH   31, Jan — 4, Feb
Leamington Spa GB   31, Jan — 3, Feb
Bradford GB   6, Feb — 11, Feb
Bradford GB   7, Feb — 9, Feb
Latest comments
by Juan Milanese
4 hours ago

Very Nice, Love the rocks man!

Awesome walkthrough, I really learnt a lot. It was great that Adrienne give links to other people tutorials too!

by stubs3d@gmail.com
7 hours ago

Anybody get that?

A Cheat Sheet on Volumetric Fog in UE4
19 May, 2017
News
Unreal Engine 4.16 has finally introduced the long-awaited Volumetric Fog. It computes participating media density and lighting at every point in the camera frustum, so you can support varying densities and any number of lights affecting the fog. H0w does one work with Volumetric Fog? Here is a little cheat note from Epic

VolumetricFog.png

Global Controls

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.

Exponential Height Fog

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.

VolumetricFogProperties.png

Properties

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.

Lights

Each light’s contribution amount to the scene and whether it shadows the fog can be controlled using the following properties.

VolumetricFogLightProperties.png

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.

Volumetric Scattering Intensity: 1 (Default)

Volumetric Scattering Intensity: 1 (Default)

Volumetric Scattering Intensity: 0

Volumetric Scattering Intensity: 0

The Spot light’s contribution to the Volumetric Fog has been disabled by setting the Volumetric Scattering Intensity to 0.

Local Controls

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.

VolumetricFogParticleMaterial.png

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.

VF_ParticleInGame.png

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.

Temporal Reprojection

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.

Performance

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 Volume domain can add a significant GPU cost, depending on their 3D overdraw and instruction count. Use the console command profilegpu to inspect this cost.
  • Point and Spot Lights that have Cast Volumetric Shadow enabled cost ~3x more than unshadowed Point and Spot Lights.

Currently Supported Features

This list comprises the currently supported features of Volumetric Fog:

  • 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 Shadowing is enabled.
  • A single Skylight, with shadowing from Distance Field Ambient Occlusion, if enabled.
  • Particle Lights, if Volumetric Scattering Intensity is greater than 0.

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.

Known Issues & Common Questions

The following features are not yet supported while using Volumetric Fog:

  • 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 Volumetric Fog itself.

  • Source Radius on Point and Spot lights.

  • Some settings in the Exponential Height Fog, like Fog Cutoff Distance, Start Distance, and Fog Max Opacity.

You can find more details on working with volumetric fog here

Source: Epic Games

Leave a Reply

Be the First to Comment!

avatar
wpDiscuz