Curve Based Exponential Fog | ebp
Post

Curve Based Exponential Fog

a flexible and believable exponential fog in Unreal Engine 4 based on Direct3D 9's Exponential Fog Equation

Curve Based Exponential Fog

Final Result

Goal and Scope

The goal of this project is to create a flexible and believable exponential fog in Unreal Engine 4 based on Direct3D 9’s Exponential Fog Equation

Reference

Direct3D 9’s Exponential Fog Equation

Core Logic

First, implement the equation of exponential fog as a barebone:

Exponential Fog Equation Exponential Fog Equation

Then, blend the fog factor with:

Fog Factor Fog Factor

After that, use a curve to control the color based on the distance between the camera:

Curve Curve

Execution

First, implement basic exponential fog:

Basic Exponential Fog Basic Exponential Fog

Then, the original color is simply the scene color:

Original Color Original Color

Here, a height based mask was calculated (use one minus because we want the bottom part to be opaque):

Height Mask Height Mask

Finally, blend them together:

Final Result Final Result

Full Graph

This post is licensed under CC BY 4.0 by the author.