Fog of war and post process occlusion mask like GORD

I need experts help to implement post process rendering with ooclusion mask together with the fog of war:
I have a pseudo code, but I cannot figure out how to implement it in the PP material

// Sample the fog of war Render Target
fogOfWarMask = TextureSample(FogOfWarRenderTargetVariable, UV);

// Sample the occlusion mask texture
occlusionMask = TextureSample(OcclusionMaskTexture, UV);

// Combine the occlusion and fog of war masks
finalMask = occlusionMask * fogOfWarMask;

// Use the final mask to modulate the occlusion effect
outputColor = ApplyOcclusionEffect(finalMask, otherParameters);

I would appreciate any help on this one.

What I’m trying to achieve is the effect like, for example, game GORD has, when you hover your unit it outlines, when the unit or enemy hidden by a tree or other is full colour but when they are blocked by a fog of war, they are hidden and not outlined.

Thanks