Documentation

Screen Space Fog Scattering for Engine 4 & 5

Post process shader that enhances the look of Exponential Height Fog by adding the simulation of light scattering inside it.
Version: 1.13

Installing the Plugin

Open Epic Games Launcher, head to Unreal Engine > Marketplace or Library tab and find Screen Space Fog Scattering. Press “Install to Engine” button and choose the appropriate engine version for you.

Open your project the engine version of which have the plugin already installed and head to Plugins tab. Find the Screen Space Fog Scattering and set it enabled by checkbox. The engine will prompt to restart itself. Restart the editor and you will have plugin enabled and ready to work.

How to use the Plugin

After enabling the plugin the new effect will work automatically in the fogged areas on your scene. All you have to do is to set up the default Exponential Height Fog component or actor of the Unreal Engine. The intensity of the scattering effect will fully depent on the settings of the fog.

It will also work with any existing blueprint or system that uses Exponential Height Fog.

Additional console commands:

NameDefault ValueDescription
r.SSFS1Enable or disable the Screen Space Fog Scattering post process effect.
r.SSFS.PassAmount8Number of passes to render the the Scattering effect.
Recommended values: 8 for Full HD, 9 for QHD, 10 for 4K resolutions.
Max number of passes is clamped to 12.
r.SSFS.Radius0.9The progressive radius of the scattering effect.
Can be used to visibly increase (or decrease) the effect while staying with certain fog density.
Recommended values are between 0.8-0.99.
r.SSFS.Intensity1.0Intensity of the effect scaled by the Exponential Height Fog.
r.SSFS.SkyAtmosphereIntensity1.0Intensity of the effect scaled by the Sky Atmosphere.
r.SSFS.VolumetricFogILSIntensity1.0Intensity of the Volumetric Fog Integrated Light Scattering on the effect.
r.SSFS.LuminanceWeighting1Use additional filtering to reduce overly bright subpixels (fireflies).
r.SSFS.HighQuality1Use High Quality sampling for the scattering effect.
Disabling can save on performance, but will reduce the quality
r.SSFS.FullPrecision1Enables using full precision HDR render passes for the scattering effect.
Disabling can save on performance, but might introduce some color loss.

Performance

Considering the render resolution, the performance cost of the effect is fixed and it is generally 40-50% more expensive than default Bloom post process effect.
Here are some results at FullHD 1080p resolution on the 1.02 version of the plugin.

GPUAverage, ms
Nvidia GeForce RTX 3080 Ti0.20
AMD Radeon RX 6800M0.24
Nvidia GeForce RTX 30600.38
Nvidia GeForce GTX 1080 Ti0.43
Nvidia GeForce GTX 16600.66

Technical Details

The plugin uses SceneViewExtensionBase engine class to safely inject the shader into the rendering pipeline. To be specific it’s Before DOF, so every other default post process effects remain compatible.

Supported Plugin Versions

Here’s a table of latest supported Plugin version for each Engine Version. Please keep in mind that due to official Marketplace Guidelines I’m only able to update the plugin on the last 3 versions of the engine.

Engine Version4.275.05.15.25.35.4
Latest supported plugin version1.011.021.121.131.131.13

Fix for the flickering issues

Generally this issue is considered to be fixed since 1.10 plugin version, but for the older plugin versions of the engine (UE 4.27-5.0, which I cannot update anymore in the Marketplace) you can try to apply the following:

  • Proceed to the plugin’s installation folder, for example “C:\Program Files\Epic Games\UE_4.27\Engine\Plugins\Marketplace\ScreenSpaceFogScattering”
  • Open “Shaders” folder and just in case backup “SSFSDownsample.usf” shader file
  • Download the fixed shader file here and replace it in this same folder
  • Restart the engine

Hotfix for UE 5.1.1 crash

There may be an occasional crash on UE 5.1.1 when the plugin is installed from the Marketplace. This is an engine issue I have no control over.
Long story short, Epic compiles plugins for distribution on the marketplace on the base version of the engine, in this case it’s 5.1.0. They did some mistakes for 5.1.1 update which made some marketplace plugins to be “binary incompatible” with 5.1.1.
To fix this crash, you need to just recompile the plugin locally (so the binaries would be compiled for 5.1.1 instead of for 5.1.0) and here’s how you can do it. It’s safe to use it after recompilation.

  1. If it isn’t done already, convert your project from BP only to C++ (Tools -> New C++ Class…). You can just add an Empty C++ Class. Close the editor.
    If you’re unable to do this, make sure you have the necessary tools installed.
  2. Copy the plugin from the engine directly to your project – for example, from:
    “C:\Program Files\Epic Games\UE_5.1\Engine\Plugins\Marketplace\ScreenSpaceFogScattering”
    To: “D:\MyProject\Plugins\ScreenSpaceFogScattering”
  3. Inside the copied plugin folder delete the Binaries and Intermediate folders.
  4. Right click on MyProject.uproject file and select Generate Visual Studio project files and wait until it’s done.
  5. Open your project and agree to a prompt to rebuild the modules. After the editor opens, make sure the plugin is enabled in the Plugins tab.

I’m really sorry for the inconveniences!

Changelog

V1.00

  • Initial release

V1.01

  • Added support for Volumetric Fog
  • Fixed a crash on startup on 5.1.1
  • Fixed the effect not being applied in DX11 (default RHI in UE4)

V1.02

  • Added support for illuminated Volumetric Fog (Point Lights, Spot Lights, etc.)
  • Fixed the effect being rendered when there’s no Exponential Height Fog on a scene
  • Fixed outlining artifacts in some cases

V1.10

  • Added luminance weighting using “Karis Average” method. This suppresses overly bright subpixels (fireflies) and greatly reduces flickering artifacts
  • Added scalability option do use high or low quality sampling for the scattering effect
  • Added scalability option to use full precision render passes for the scattering effect
  • Added support for Sky Atmosphere
  • Improved blending of Volumetric Fog Integrated Light Scattering

V1.11

  • Fixed (prevented) NaN values of the SceneColor texture to getting into SSFS shader

V1.12

  • Fixed wrong “MaxWorldObserverHeight” value
  • Updated descriptions of some CVars
  • Updated copyrights in source code

V1.13

  • Added ECVF_Scalability flag to a couple of CVars – r.SSFS & r.SSFS.PassAmount