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!
Anybody get that?
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.
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.
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).
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.
Controls how much the participating media blocks light.
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.
- Particles using Volume domain can add a significant GPU cost, depending on their 3D overdraw and instruction count. Use the console command
profilegputo 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.