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.
Using Exponential Height Fog
In the Place Actors panel, select the Exponential Height Fog Actor, 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. Use the Fog Height Falloff to further adjust the height.
Exponential Height Fog Properties
In the Exponential Height Fog Component section, you can edit the following properties related to the component:
| Property | Description |
|---|---|
| Exponential Height Fog Component | |
Fog Density | This is the global density factor, which can be thought of as the fog layer's thickness. |
Fog Height Falloff | Height density factor controls how the density increases as height decreases. Smaller values make the transition larger. |
Second Fog Data | These settings control the secondary fog level. Setting the Fog Density of this secondary fog layer to 0 will have no influence.
|
Fog Inscattering Color | Sets the inscattering color for the fog. Essentially, this is the fog's primary color. It's ignored when the Support Exponential Fog Matches Volumetric Fog project setting is enabled. |
Sky Atmosphere Ambient Contribution Color Scale | This color is used to modulate the Sky Atmosphere component contribution to the non-directional component of the fog. It only has an effect when the Support Sky Atmosphere Affecting Height Fog project setting is enabled. |
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. |
End Distance | Distance from the camera, on the horizontal XY plane, at which the fog stops accumulating lighting and opacity. A value of 0 disables it. |
Fog Cutoff Distance | Scene elements past this distance will not have fog applied. This is useful for excluding skyboxes that already have fog baked into them. |
| Inscattering Texture | |
Inscattering Color Cubemap | Cubemap that can be specified for fog color, which is useful to make distant, heavily fogged scene elements match the sky. When the cubemap is specified, Fog Inscattering Color is ignored, and Directional inscattering is disabled. |
Sky Light Capture In-Scattering Strength | When greater than 0, the Sky Light's captured cubemap adds scattered light to the height fog. |
Sky Light Capture In-Scattering Roughness | The roughness at which the Sky Light capture cubemap is sampled to simulate how the fog scatters light. Higher values give a blurrier result. |
Inscattering Color Cubemap Angle | Angle to rotate the Inscattering Color Cubemap around the Z (height) axis. |
Inscattering Texture Tint | The tint color used when Inscattering Color Cubemap, which is useful for making quick edits without having to reimport the cubemap specified with Inscattering Color Cubemap. |
Fully Directional Inscattering Color Distance | Distance at which Inscattering Color Cubemap should be used directly for the Inscattering Color. |
Non-Directional Inscattering Color Distance | Distance at which only the average color of Inscattering Color Cubemap should be used as Inscattering Color. |
| Directional Inscattering | |
Directional Inscattering Exponent | Controls the size of the directional inscattering cone, which is used to approximate inscattering from a directional light source. Directional inscattering only works when a Directional Light in the level has Atmosphere Sun Light enabled. |
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. |
| Volumetric Fog | |
Volumetric Fog | Whether to enable Volumetric Fog. Scalability settings control the resolution of the fog simulation. The Volumetric Fog currently does not support Start Distance, Fog Max Opacity, and Fog Cutoff Distance. In general, it cannot match Exponential Height Fog, since it has non-physical behavior. |
Scattering Distribution | Controls the scattering phase function—how much incoming light scatters in various directions. A distribution value of 0 scatters equally in all directions, while a value of 0.9 scatters predominantly in the light direction. In order to have visible volumetric fog light shafts from the side, the distribution will need to be closer to a value of 0. |
Albedo | The height fog particle reflectiveness used by Volumetric Fog. Water particles in the air have an albedo near white, while dust has slightly darker value. |
Emissive | Light emitted by Exponential Height Fog. This is a density, so more light is emitted the further you are looking through the fog. In most cases, Sky Light is a better choice. However, Volumetric Fog does not support precomputed lighting right now, so Stationary Sky Light is unshadowed, and Static Sky Light doesn't affect Volumetric Fog at all. |
Extinction Scale | Scales the height fog particle extinction amount used by Volumetric Fog. Values larger than 1 cause fog particles everywhere absorb more light. |
View Distance | Distance over which Volumetric Fog should be computed. Larger values extend the effect into the distance but expose under-sampling artifacts in details. |
Start Distance | The distance from the camera that the Volumetric Fog will start, in world units. |
Near Fade In Distance | The distance over which Volumetric Fog will fade in from the start distance. |
Static Lighting Scattering Intensity | Controls the intensity of scattered static lighting in the Volumetric Fog. |
Override Light Colors with Fog Inscattering Colors | Whether to use Fog Inscattering Color for the Sky Light's Volumetric Scattering Color and Directional Inscattering Color for the Directional Light's Scattering Color. Make sure your Directional Light has Atmosphere Sun Light enabled. It allows Volumetric Fog to better match Exponential Height Fog in the Distance but produces non-physical volumetric lighting that may not match surface lighting. |
Fog Screen Space Scattering
Fog Screen Space Scattering approximates light scattering many times through the fog by blurring the scene behind it, which gives thick fog a soft, hazy glow. These settings are in the category's advanced section.
| Property | Description |
|---|---|
Enable Fog Screen Space Scattering | Whether to approximate multiple scattering in the fog using screen space scattering. |
Scene Color Scattering Amount Scale | How much scene color is scattered along with the fog. At 0, only the fog's own color is scattered. At 1, both fog and scene color are scattered. Values above 1 brighten the effect even where the fog is thin. |
Scene Color Scattering Amount Power | A power applied to the amount of scattered scene color after Scene Color Scattering Amount Scale. Values below 1 show more scattering where the fog is less dense. |
Spread Scale | How far the scattering spreads. Higher values make the scene and thick fog look fuzzier, but values that are too high can cause halos around the edges of objects. |
Blur Control | How much of the blurrier scattering is mixed back into the sharper result. Higher values give a blurrier result. At 1, the scattering becomes a single average color. |
Using Exponential Height Fog Features
The sections below cover the usage of some of the features found in the Exponential Height Fog volume:
Secondary Fog Layer
Add a second fog layer to your level using the properties found under the Second Fog Data category. It enables you better define and control fog at a second Z (height) level in your map with controls for density, height falloff, and height offset.
Volumetric Fog
Control Volumetric Fog by enabling it in the Exponential Height Fog's Details panel under the Volumetric Fog category.
Unreal Engine's Volumetric Fog computes participating media density and lighting at every point in the camera frustum so that varying densities and any number of lights affecting the fog can be supported.
See Volumetric Fog for additional details and usage.
Performance
The rendering cost of Exponential Height Fog is similar to two layers of constant density height fog with an additional optimization; fog Start Distance. The start distance is 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.
Below are examples of this in practice:
Fog Start Distance: 0
Fog Start Distance: 5000
Fog Start Distance: 5000 with high fog density
Fog Start Distance Preview
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.
The Expense of Cloud Rendering
When r.PostProcessing.PropagateAlpha is enabled and any feature, such as Volumetric Cloud, Sky Atmosphere, and Exponential Height Fog, has alpha holdout enabled, cloud rendering uses the expensive rendering path.