
FOW Compute Shader Plugin
GPU-accelerated fog of war for Unreal Engine 5, published on Fab: compute-shader visibility mask, GPU readbacks, memory, height-aware occlusion and four premade effects.
Description
I just released my first Plugin on the Fab Marketplace, featuring a GPU-accelerated Fog of War system for Unreal Engine^^.
It was at first developed for our Game Project "Obscura", but I decided to build out into its own little plugin, making the system a lot more versatile and adaptable. The Fog of War for our game had to achieve high fidelity, good performance and had to be able to affect gameplay mechanics. I solved this by creating custom compute shaders, writing a smooth mask into an editor exposed render target texture, with which I control various fog effects.
At first, the CPU calculated its own visibility mask in order to control game mechanics. However, the final plugin allows for single or batched GPU Readbacks, making it possible to query the actual visibility mask, respecting the occlusion, fades and memory.
To package the game's FOW mechanics into the plugin, I cleaned and expanded the system radically, adding a ton of new features and improving the various shader pipelines.
The resulting, final system features memory for already discovered areas, different hide modes for actors, height aware occlusion with different raymarching techniques, visibility queries and a lot more. Due to relying on compute shaders, the system can handle a multitude of vision sources (10000+).
Even though the plugin primarily aims to enable the creation of cool, self made Fog of War Effect, the plugin comes with four premade effects. They are meant as examples, utilizing different shader domains.
- a translucent surface Material for layered meshes (fake volumetric effect - used in our RTS game)
- a Volume Material
- a light function Material
- a post-process Material
The full documentation can be found here:
The plugin product page can be found here:
Maybe in a future post, I will go into depth about the main premade fog effect and explain its shader graph..
Media

The plugin comes with an example project, which allows the user to try out the different settings and premade fog effects.

Our game uses multiple transparent layers, using the same mesh as the water plane. The effect is very cheap and works perfectly for top down RTS games.


The calculated mask can also be used inside a lightfunction..



.. or a postprocess material.

