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:
Then, blend the fog factor with:
After that, use a curve to control the color based on the distance between the camera:
Execution
First, implement basic exponential fog:
Then, the original color is simply the scene color:
Here, a height based mask was calculated (use one minus because we want the bottom part to be opaque):
Finally, blend them together:
Full Graph
This post is licensed under CC BY 4.0 by the author.