Wartorn Tech | Volumetric Fog of War
A treefolk unit enshrouded in fog from all sides.

A treefolk unit enshrouded in fog from all sides.

Moving units through the fog of a forest map and encountering some enemies. Enemies located outside friendly unit(s) fog radius are not visually rendered

An overhead view of the of the punched out region of fog sampled from a render target

An overhead view of the of the punched out region of fog sampled from a render target

Render targets for the initial overhead capture of the terrain (done one single time, used to tint the fog), and the real-time position of a single player unit (done asynchronously on the GPU and used to punch out the fog density).

Render targets for the initial overhead capture of the terrain (done one single time, used to tint the fog), and the real-time position of a single player unit (done asynchronously on the GPU and used to punch out the fog density).

The custom fog of war actor that is added to each map, the default or custom data asset that the fog actor reads from, and material instance parameters for controlling fog visuals.

The custom fog of war actor that is added to each map, the default or custom data asset that the fog actor reads from, and material instance parameters for controlling fog visuals.

Wartorn Tech | Volumetric Fog of War

Fog of war is usually a 2D affair — a screen-space post-process or a texture mask draped over the map that darkens or hides whatever the player hasn't explored yet. It works, but it tends to read as a layer sitting on top of the image rather than something part of the world, and for Wartorn that didn't fit the art direction. The approach taken here instead drives the fog of war through Unreal's volumetric fog, so unexplored areas are obscured by actual fog living in the scene — it catches light, settles into the terrain, and reads as atmosphere rather than a UI overlay.

To determine what the fog hides, the system uses a render target to capture the entire level from above, and that capture is used to punch out the regions of the fog material where the player currently has units, clearing the fog in a radius around each one. That mask is then fed back into the volumetric fog as its density driver, so visibility stays data-driven by where units actually are on the map rather than being baked or hand-placed.

The complication was performance. By default, scene captures in Unreal run on the game thread, and capturing the level to keep the fog mask up to date introduced hitches severe enough to be a non-starter — particularly on a roguelike-hybrid that generates a large number of distinct maps. Resolving it required writing a custom asynchronous rendering path that moves the capture work off the game thread, so the fog-of-war updates without stalling the frame. The result is a fog of war that behaves like real volumetric atmosphere while staying cheap enough to run continuously during play.

More artwork