Exponential Height Fog User Guide

This document covers Exponential Height Fog and its uses. It assumes that you have a level already set up in which you would like to add Exponential Height Fog.

Exponential Height Fog creates more density in low places of a map and less density in high places. The transition is smooth so you never get a hard cutoff as you increase altitude. Exponential Height Fog also provides two fog colors, one for the hemisphere facing the dominant directional light (or straight up if none exists), and another color for the opposite hemisphere.

ExponHeightFog.png

Using Exponential Height Fog

In the Modes panel, select the Exponential Height Fog Actor, which is under Visual Effects. Left-click and drag to place it in the world.

Positioning the Exponential Height Fog Actor will determine the height of the fog.

Exponential Height Fog Properties

In the Height Fog section, you can edit the following properties related to the component:

Property

Description

Fog Density

This is the global density factor, which can be thought of as the fog layer's thickness.

Fog Inscattering Color

Sets the inscattering color for the fog. Essentially, this is the fog's primary color.

Fog Height Falloff

Height density factor, controls how the density increases as height decreases. Smaller values make the transition larger.

Fog Max Opacity

This controls the maximum opacity of the fog. A value of 1 means the fog will be completely opaque, while 0 means the fog will be essentially invisible.

Start Distance

Distance from the camera that the fog will start.

Directional Inscattering Exponent

Controls the size of the directional inscattering cone, which is used to approximate inscattering from a directional light source.

Directional Inscattering Start Distance

Controls the start distance from the viewer of the directional inscattering, which is used to approximate inscattering from a directional light.

Directional Inscattering Color

Sets the color for directional inscattering, used to approximate inscattering from a directional light. This is similar to adjusting the simulated color of a directional light source.

Visible

Controls primary fog visibility.

Actor Hidden in Game

Whether to hide the fog in game.

Editor Billboard Scale

The scale to apply to any billboard components in editor builds.

Animating Exponential Height Fog

To animate Exponential Height Fog, use Matinee to animate the Exponential Height Fog Actor values. For more information, see the Matinee User Guide page.

You can also animate Exponential Height Fog directly in Level Blueprint, by way of a timeline or by any network of nodes driving the functions and properties of the fog Actor.

Color

Height Fog Color is now able to be changed at runtime using the Linear Color Property Track in Matinee. Here is how to set up Matinee to let you change Height Fog Color in-game:

  1. Create a Matinee Actor and open it using the Matinee button in the Editor toolbar.

  2. Create a HeightFog Actor.

  3. Create a group in Matinee with that Actor attached.

  4. Create a linear color property track in the above group.

  5. A dialog should appear letting you choose which color property to interpolate. There should be only two options: FogInscatteringColor and DirectionalInscatteringColor.

  6. Once that track is set up, you can place keyframes and use the context menu (Right-click) or the Curve Editor to set the color for each key.

Performance

The rendering cost of Exponential Height Fog is similar to two layers of constant density height fog with an additional optimization:

The !FogStartDistance can be used to artificially keep some defined area in front of the viewer without fog. This also helps performance as pixels can be culled by the z buffer.

The following images show this applied:

Density0.jpg

Density1000.jpg

Density1000HighFog.jpg

Fog Start Distance = 0

Fog Start Distance = 1000

Fog Start Distance = 1000 with a high Fog Density value

Depending on the scene content and when using a far fog start distance, the rendering cost can be 50% or less. This optimization is implemented by rendering a full screen quad that has a z value and depth test enabled.