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:
ACFOWSpawneris placed in the level with a reference to aDataTablerow (FCFOWMakerStruct) and a pawn to track.- On
init, the spawner retrieves theAPostProcessVolumein the level and instantiatesUCFOWMakerwith the configuration, render targets and materials. - On tick, the spawner calls
UCFOWMaker::buildASyncwith the tracked pawn position. buildASyncruns asynchronously: it determines the closest room cluster, checks if the fog plane needs updating, and enqueues draw commands.updateFog_syncdequeues on the game thread: it clears render targets, resizes/repositions the dynamic mesh to match the cluster bounds, and adjusts material scale parameters.- The fog component (on the player pawn) paints into the render targets for line-of-sight and revealed areas.
- An optional post-process material blends the fog into the scene via
APostProcessVolume. - Perspective changes (top view / first person) toggle fog visibility via
ICPlayerControllerBoundable.