CFOWUMODULE

Overview

The CFOWUMODULE is a runtime Fog of War system that renders visibility masks on a dynamic mesh plane aligned with room clusters. It uses render targets to paint line-of-sight and revealed areas, driven by a material with optional blur post-processing. The fog tracks a pawn and reacts to perspective changes (top view / first person).

Depends on CCOREUMODULE (spawner system, singletons, interfaces, room/world utilities).

Functionalities Overview
Data Configuration structure for fog rendering (FCFOWMakerStruct)
CFOWSpawner Spawner actor that drives fog generation at runtime, tracking a pawn (ACFOWSpawner)
CFOWMaker Core fog builder that manages render targets, dynamic mesh and material parameters (UCFOWMaker)
Blueprint Blueprint-callable functions for adding/removing fog agents (UCFOWBPLibrary)

Architecture

The fog of war pipeline works as follows:

  1. ACFOWSpawner is placed in the level with a reference to a DataTable row (FCFOWMakerStruct) and a pawn to track.
  2. On init, the spawner retrieves the APostProcessVolume in the level and instantiates UCFOWMaker with the configuration, render targets and materials.
  3. On tick, the spawner calls UCFOWMaker::buildASync with the tracked pawn position.
  4. buildASync runs asynchronously: it determines the closest room cluster, checks if the fog plane needs updating, and enqueues draw commands.
  5. updateFog_sync dequeues on the game thread: it clears render targets, resizes/repositions the dynamic mesh to match the cluster bounds, and adjusts material scale parameters.
  6. The fog component (on the player pawn) paints into the render targets for line-of-sight and revealed areas.
  7. An optional post-process material blends the fog into the scene via APostProcessVolume.
  8. Perspective changes (top view / first person) toggle fog visibility via ICPlayerControllerBoundable.