Skip to content

GPU Fog of War for Unreal Engine 5

Welcome to the tech blog + documentation for my UE5 Fog of War plugin.

Its a GPU - Fog of War system developed for our Game Project "Obscura". The Fog of War for our game had to show a high fidelity, good performance and allow for different gameplay options. The resulting system features memory for already discovered areas, different hide modes for actors, heightaware occlusion and visibility queries. Great performance, even with a multitude of vision sources, is achieved by the use of compute shaders. It is also Blueprint‑friendly and multiplayer‑safe.

Highlights

  • Excellent Performance through compute shaders.
  • Height‑aware occlusion (capture component + different ray modes).
  • Memory for already explored areas.
  • Actor Freeze and Hide Mechanics Smoothly hides or freezes actors when outside the view area (even after destruction).
  • Actor-Components for ease of use: Vision, Blocker, Stealth.
  • Multiple premade Fog variants: layered mesh, volumetric box, post-process, and light function.
  • Batched visibility queries to get visibility info onto the CPU.
  • Multiple, stackable Fog Instances allows to have multiple FOWs completly independent from each other (even on top of each other).
  • High Customizeability and Adaptability: Multitude of User-Settings and -Options.
  • Blueprint‑friendly and Multiplayer‑safe.

Platform & Engine Support

Legend: Supported · Partial · Not supported · Not yet tested

OS / API \ UE Version 5.3 5.4 5.5 5.6
Windows - DX11 OK OK OK OK
Windows - DX12 OK OK OK OK
Linux - Vulkan Not yet tested Not yet tested Not yet tested Not yet tested
macOS - Metal Not yet tested Not yet tested Not yet tested Not yet tested

So far the Plugin has not been tested on either linux or macOS

API 5.3 5.4 5.5 5.6 Notes
DX11 OK OK OK OK ...
DX12 OK OK OK OK Preferred on modern GPUs.

Examples

Here a short, visual overview of the plugin's capabilities. The first part goes over the technical capabilities, while the second part shows the fidelity achieveable with the plugin.

Example Project

The available Example Project allows to play around with four different Fog Variants and the most important runtime settings via Widgets. It serve as an example to quickly learn how to use the different parts of the plugin.

A freely available build of the example project can be found here. The unreal project is included with the paid version of the plugin.

The following screenshot shows Vision Sources (white cylinders), Actors hiding within the fog (green cubes), Actors freezing within the fog (orange spheres) and Actors occluding the vision. The top left fog is done with an volumetric material inside a box, the top right with a light function, the bottom left with layered meshes and the bottom right with a post-process material.

Overview

This Video shows the four different Fog Variants in action, using the default settings. It shows off the occluion, the freeze or hide mechanics, the memory system and the fade in and out of the fog.

In this video you can better see the occlusion and how the actors react to the fog.

This final video goes over different settings and shows how they affect the fog. Additionally, it visualizes the underlying state of the used render target.

In-Game Screenshots

The following screenshots show different Fog Variants achieved with the plugin within our game "Obscura". The four variants are:

  • Layered Meshes
  • Light Function
  • Post-Process
  • Volumetric Box

The Fog Types are shown in this order (except volumetric box) and are also easily setup using the Plugins FOW-Manager. However, fully customized Fog Types can be created using the plugin's API.

Layered Meshes

This cheap "fake" volumetric fog is achieved by layering multiple meshes on top of each other. This type of fog is allows for high fidelity with good performance, but breaks down when looking at it from too steep angles.

In-Game Screenshot Layered Meshes In-Game Screenshot Layered Meshes In-Game Screenshot Layered Meshes In-Game Screenshot Layered Meshes In-Game Screenshot Layered Meshes

Light

By using Unreal's Light Function, the system can block light within unseen areas.

In-Game Screenshot Light-Function In-Game Screenshot Light-Function In-Game Screenshot Light-Function In-Game Screenshot Light-Function

Post-Process

The system can also be used to create Post-Process effects to hide invisible areas.

In-Game Screenshot Post-Process In-Game Screenshot Post-Process In-Game Screenshot Post-Process