Fog of War (UE5) - API Reference
This page documents the public API of the Fog of War plugin as exposed by the Subsystem, Actor Components, and the Manager. It’s written for Blueprint and C++ users.
Concepts & Data Types
- Fog Instance: A named fog layer (render target + runtime settings). Multiple instances are supported and updated in order.
- Revealers: Vision sources that write visibility (smooth circles) into the fog.
- Blockers / Occluders: Circular blockers and/or depth-capture-driven occlusion; optional height-aware checks and distance field.
- Stealth: Policy that hides, fades, or “freezes as ghost” when an actor is not visible in fog.
Key structs / enums (Blueprint-exposed):
FFOW_AreaSettings- Center (FVector), FullExtents (FVector2D), YawDeg (float).FFOW_RuntimeSettings- Toggles (Enabled/Freeze/ShowFog/ShowMemory/FreezeMemory), Visual (ExploredValue, ActorVisibilityThreshold, SmoothFalloff, Blur settings), Blending (Transitiontype, FadeInRate, RelaxRate, ForgetRate), Occlusion (RayMode, DFScale, UseHeightOcclusion, Capture options), Performance (LOD, UpdateRate, TileSize/MaxPerTile, UpdateOnlyOnChanges).FVisionData- WorldPos, RangeWS, EyeHeightOffsetWS.EFOWActivationPolicy,EFOWVisibilityPolicy,EFOWHiddenMode,EFOWOcclRayMode,EFOW_TransitionBehaviour.
Subsystem (UFOWSubsystem)
Access via:
auto* FOW = GetWorld()->GetSubsystem<UFOWSubsystem>();
The subsystem (client-side) owns all Fog Instances and dispatches the GPU work.
Lifecycle & Materials
void ResetFogSystem(): Clears memory/registries, detaches delegates, and resets the state.void ClearAllMemory(): Clears “last seen” memory for all instances.bool ClearMemory(FName FogInstance = NAME_None): Per-instance memory clear (NAME_None= primary).UMaterialInstanceDynamic* AcquireSharedMIDForFogInstance(FName FogInstance, UMaterialInterface* Base): Returns a shared, auto-updating MID with fog parameters & RT bound.
Fog Instance Management
FName GetPrimaryFogInstanceName() constvoid GetFogInstancesNames(TArray<FName>& Out)bool AddOrReplaceFogInstance(const FFOW_FogConfig& Config)bool RemoveFogInstanceByName(FName Name)void AddProfile(const UFOWProfile* Profile)/void RemoveProfile(const UFOWProfile* Profile)bool GetFogInstanceRuntime(FName, FFOW_RuntimeSettings& Out) constbool GetFogInstanceArea(FName, FFOW_AreaSettings& Out) const
Runtime Settings
All setters return bool and accept NAME_None to target the Primary instance.
Toggles
SetFogInstanceEnabled(FName, bool)SetFogInstanceFreezeState(FName, bool)SetFogInstanceShowFog(FName, bool)SetFogInstanceShowMemory(FName, bool)SetFogInstanceFreezeMemory(FName, bool)
Visuals
SetFogInstanceExploredValue(FName, float /*0..1*/)SetFogInstanceActorVisibilityThreshold(FName, float /*0..1*/)SetFogInstanceSmoothFalloff(FName, float /*0..1*/)SetFogInstanceBlurIterations(FName, int32)SetFogInstanceBlurRadius(FName, int32)SetFogInstanceBlurSigma(FName, float)
Blending
SetFogInstanceTransitionMode(FName, EFOW_TransitionBehaviour)SetFogInstanceFadeInRate(FName, float)SetFogInstanceRelaxRate(FName, float)SetFogInstanceForgetRate(FName, float)
Occlusion
SetFogInstanceOcclusionRayMode(FName, EFOWOcclRayMode)SetFogInstanceDFScale(FName, int32 /*>=1*/)SetFogInstanceUseHeightOcclusion(FName, bool)SetFogInstanceUseDepthCaptureOcclusion(FName, bool)SetFogInstanceCaptureUsesShowOnly(FName, bool)SetFogInstanceUpdateOnlyIfTransformChanged(FName, bool)
Performance
SetFogInstanceLOD(FName, int32 /*1..32*/)SetFogInstanceUpdateOnlyAtCrucialChanges(FName, bool)SetFogInstanceTileSize(FName, int32)SetFogInstanceMaxPerTile(FName, int32)SetFogInstanceUpdateRate(FName, float /*seconds, >= 0.01*/)void SetStealthActorUpdateRateSeconds(float Seconds)
Bulk
bool SetFogInstanceRuntime(FName, const FFOW_RuntimeSettings&)
Area & Transform
bool SetFogInstanceArea(FName, const FVector& Center, const FVector2D& FullExtents, float YawDeg)bool ExpandFogInstanceAreaToInclude(FName, const FVector& OtherCenter, const FVector2D& OtherFullExtents, float OtherYawDeg /*keeps A’s yaw*/ )
Vision Sources (Revealers)
Actor-based
void RegisterVisionSource(AActor* Source, float RangeWS, float EyeHeightOffsetWS = 0.f)void UnRegisterVisionSource(AActor* Source)void ClearAllVisionSources()
Static (handles)
int32 AddStaticRevealer(FVector WorldPos, float RangeWS)void RemoveStaticRevealer(int32 Handle)bool SetStaticRevealerRange(int32 Handle, float NewRangeWS)void ClearAllStaticRevealers()
The GPU pipeline later bins revealer informration into tiles based on their location and draws a smooth circlearound them.
Blockers / Occlusion
Blockers can be actor-based (follow the actor) or static (fixed world position). Occlusion can come both from either circles around these blockers or from depth captures.
Actor-based
void RegisterBlocker(AActor* Actor, float RadiusWS, FVector LocalOffsetWS = FVector::ZeroVector, float HeightWS = 0.f, bool bUseHeightLayer = false)void UnregisterBlocker(AActor* Actor)void ClearAllBlockers()
Static (handles)
int32 AddStaticBlocker(const FVector& WorldPos, float RangeWS, float HeightWS = 0.f, bool bUseHeightLayer = false)void RemoveStaticBlocker(int32 Handle)void ClearAllStaticBlockers()bool SetStaticBlockerRange(int32 Handle, float NewRangeWS)bool SetStaticBlockerHeight(int32 Handle, float NewHeightWS)bool SetStaticBlockerUseHeightLayer(int32 Handle, bool bUseHeightLayer)
Depth-capture (for capture-based occlusion)
int32 AddCaptureActorToAllFogInstances(AActor* Actor)int32 RemoveCaptureActorFromAllFogInstances(AActor* Actor)bool AddCaptureActorToFogInstance(FName FogInstanceNameOrNone, AActor* Actor)bool RemoveCaptureActorFromFogInstance(FName FogInstanceNameOrNone, AActor* Actor)bool ClearCaptureActorsForFogInstance(FName FogInstanceNameOrNone)
Use circle blockers for cheap, radius-based occlusion (walls, big rocks) and capture actors when you want height-aware, mesh-accurate occlusion.
Stealth Actors
void RegisterStealthActor(AActor* Actor, EFOWHiddenMode HideMode, EFOWVisibilityPolicy Policy)void SetStealthVisibilityPolicy(AActor*, EFOWVisibilityPolicy)void SetStealthHiddenMode(AActor*, EFOWHiddenMode)void SetStealthActorHideThresholdOverride(AActor*, float ThresholdOrNegative /*<0 = system default*/ )
Position Queries (GPU)
- Handle types:
FFOWPositionQueryHandleBP(Blueprint) /FFOWPositionQueryHandle(C++ internal) - What it does: Samples the composed fog at N world positions and returns per-position fog values (0..1) via non-blocking GPU readback (plus visibility flags via a threshold).
Threshold behaviour
Threshold < 0→ use each Fog Instance’s ownActorVisibilityThreshold.Threshold >= 0→ use this override for the whole query (0..1).
Blueprint latent helpers
void CheckPointVisibility(UObject* WorldContextObject, FLatentActionInfo LatentInfo, FVector WorldPosition, bool& bIsVisible, float& OutValue, float Threshold = -1.0f)void CheckPointsVisibility(UObject* WorldContextObject, FLatentActionInfo LatentInfo, const TArray<FVector>& WorldPositions, TArray<bool>& OutVisible, TArray<float>& OutValues, float Threshold = -1.0f)
Use these when you just need a one-shot answer in Blueprint (they complete once the GPU readback is ready).
Low-level handle API
FFOWPositionQueryHandleBP StartPositionQuery_Auto(const TArray<FVector>& WorldPositions, float ThresholdOverwrite = -1.0f)bool PollPositionQueryResults(FFOWPositionQueryHandleBP Handle, TArray<bool>& OutFlags, TArray<float>& OutValues)FFOWPositionQueryHandleBP StartPositionQueryForActors_Auto(const TArray<AActor*>& Actors, float Threshold = -1.0f)
Typical pattern: start a query (positions or actors), store the handle, then call
PollPositionQueryResultsin a later frame until it returnstrue, at which pointOutFlags/OutValuesare valid.
Actor Components
UFOWVisionComponent
Attach to reveal fog around the actor.
Properties
Activation(Manual / AutoOnBeginPlay)VisionRange(cm)EyeHeightOffset(for height-aware occlusion)
Blueprint API
ActivateForFOW(),DeactivateForFOW()SetVisionRange(float),GetVisionRange()SetEyeHeightOffset(float)IsRevealing()
On activation it registers with the subsystem; changing range/offset while active re-registers to apply changes.
UFOWBlockerComponent
Attach to provide occlusion either as simple circles or via depth capture writes into one or many fog instances.
Modes
Circle(radius)CaptureWriter(SceneCapture-driven occlusion input)
Properties
Activation(Manual / AutoOnBeginPlay)BlockerRadius(Circle, cm)bAllFogInstances(CaptureWriter)TargetFogInstances(CaptureWriter)
Blueprint API
ActivateForFOW(),DeactivateForFOW()SetMode(EFOWBlockerMode)SetBlockerRadius(float)AddToAllFogInstancesCapture(),RemoveFromAllFogInstancesCapture()AddToFogInstanceCapture(FName),RemoveFromFogInstanceCapture(FName)
UFOWStealthComponent
Attach to actors that should hide/fade/freeze when not visible in fog. Handles material fades and optional ghost sync.
Properties
ActivationHiddenMode(Hide,FreezeWithGhost)VisibilityPolicy(FogDriven,AlwaysVisible,AlwaysHidden)bUseStealthVisibilityThresholdOverride+StealthVisibilityThresholdOverride(0..1)FadeSeconds,FadeParamName,bHideActorAfterFadeOut
Blueprint API
ActivateForFOW(),DeactivateForFOW()SetHiddenMode(EFOWHiddenMode)SetVisibilityPolicy(EFOWVisibilityPolicy)SetStealthVisibilityThresholdOverride(bool bEnable, float Threshold01)SetFadeSeconds(float)SetFadeParam(FName)- Events:
OnBecameVisible,OnBecameHidden
Manager (AFOWManager)
A convenience actor that wires profiles, premade *visual fog variants into the Fog of War subsystem.
It just helps to build and maintais the visuals + Fog Instance areas and can also be referenced as an example on how to setup custom visuals.
Responsibilities
- Registers / unregisters
UFOWProfileassets withUFOWSubsystem. - Spawns visual variants (Layered Meshes, Post Process, Volumetric Box, Light Function) for chosen Fog Instances.
- Optionally updates Fog Instance areas from its own bounds / adopted geometry.
- Temporarily overrides light functions and restores them on cleanup.
Key properties
TArray<UFOWProfile*> Profiles
Profiles to add/remove on BeginPlay/EndPlay (external Fog Instances).TArray<FFogVariant> Variants
Per-Fog-Instance visual setup (type, materials, box size, area sync, adopted actors).
Core API
- Profiles / variants:
void ReapplyProfiles()- re-registersProfileswith the subsystem.void RebuildFogVisuals()- clears and rebuilds all visuals fromVariants.
- Component adoption:
bool AdoptComponent(UActorComponent*)bool UnadoptComponent(UActorComponent*)void ClearAdoptedComponents()
- Light adoption:
bool AdoptLight(ULightComponent*)bool UnadoptLight(ULightComponent*)void ClearAdoptedLights()
Variant types (summary)
- Fog Layered Meshes - vertical slice stacks; bind a shared fog MID; can use the primitives of adopted components for the slices.
- Post Process - local or global PP blendable that samples the fog texture; optional area update from a box.
- Volumetric Box - proxy mesh volume with fog material; box size can come from
BoxHalfExtentor adopted components. - Light Function - applies a fog-aware light function MID to adopted lights and/or lights listed in the variant.
Project Settings & Profiles
Project Settings → Plugins → Fog Of War (UFOWSettings)
- DefaultFogInstances - initial fog instances (one internal allowed; others external).
- GlobalFogDefaultUpdateRate - cadence fallback.
- GlobalStealthActorUpdateRate - stealth polling rate.
- Default materials for Manager variants (Fogged Mesh / Volumetric Box / Post Process / Light Function).
Profiles (UFOWProfile)
- Data assets with external-only Fog Instances.
- Add/remove via Subsystem or Manager at runtime.
- Names are sanitized (unique, non-empty).
Examples
Blueprint quick starts
// Reveal an actor on BeginPlay
Add Component: FOWVisionComponent
Activation = AutoOnBeginPlay
VisionRange = 2500
// Hide an enemy when not visible
Add Component: FOWStealthComponent
HiddenMode = Hide
VisibilityPolicy = FogDriven
FadeSeconds = 0.25
FadeParamName = "FOW_Visibility"
// Use a blocker that writes into depth captures of all instances
Add Component: FOWBlockerComponent
Mode = CaptureWriter
bAllFogInstances = true
C++ snippets
// Toggle memory on the primary instance
if (auto* FOW = GetWorld()->GetSubsystem<UFOWSubsystem>())
{
FOW->SetFogInstanceShowMemory(NAME_None, true);
}
// Bind a MID with fog params and RT to a mesh
if (auto* FOW = GetWorld()->GetSubsystem<UFOWSubsystem>())
{
UMaterialInstanceDynamic* MID = FOW->AcquireSharedMIDForFogInstance(NAME_None, BaseMat);
Mesh->SetMaterial(0, MID);
}
// Register a static revealer
if (auto* FOW = GetWorld()->GetSubsystem<UFOWSubsystem>())
{
int32 Handle = FOW->AddStaticRevealer(GetActorLocation(), 1800.f);
// Store handle to update or remove later
}