PostProcess rendering material, Fog Of War

Hello everyone, i know it might be stupid question to ask, but to be honest i dont even know how i would google this question. I needed a Fog of War for my game, and i found this brilliant demo on Youtube, and i was able to mimic this system myself, and it works, but i want to make it better suited for my usecase. I want some area where player starts to be always visible, then the further it goes from a player, the fog becomes more thick. I have uploaded pictures of that im trying to do and how i have done it so far. I really hope for some help around this topic, as there is not much info online about FogOfWar. In 2 words im trying to achieve the fog like in XCOM, how it gradually increases from the player start.


This is what i have so far, i was able to make the triangle i was looking for but now i need to make it circular with fade over distance, and i dont even know where to start or what to look for.


This is the result im hoping to see at the end.

I will appreciate any help with deeper understanding of material scripting

Go back to basics so it’s actually usable in game without overloading the shader.

Make the cone into an alpha image.
Manipulate the alpha UV to enalrge/rotate/shrink the cone.

Base the fog out of the cone image by using it as the alpha of a lerp.

In your case (with the cone bring white) you’ll want to swap the lerp values around so that full fog is at 0 and no fog is at 1.

As far as rotating and managing the cone you have a billion options.
You need player location and player forward vector into the PP material, so probably use a MPC for it.

Making the cone via UV could also be performant if done correctly, but why waste effort when using an image is going to be faster and allow you to do any shape?

1 Like