# Dissolving fog of war when entering a room

I want to achieve a similar effect to what you see in the following clip from Enter the Gungeon. When a character enters a new area, I want a dissolving fog of war which begins dissolving at the character and gradually expands outward.

https://youtu.be/3SzOXAzO_TA?t=848

Currently, I just have black rectangles connected to areas and I animate their transparency uniformly when the player enters the area. But this is nowhere near as satisfying as the gradient dissolve that you see in the Gungeon clip.

So, I am looking for advice on how to achieve dissolving fog of war like that seen in the clip.

I was thinking I could do it using the lighting resources of the engine I am working in, Godot 3.0. For example, I could add a Light2D to the color rect that is initially invisible. When the player enters the area, I could position the Light2D, make it visible, and then animate it so that it gradually expands outward. Unfortunately, I can't seem to set up the Light2D properly to dissolve the color rect (not sure what kind of texture or render mode to use).

I could also do it with a shader, perhaps, though I am a novice when it comes to shaders. I guess the idea would be to add the shader to the color rect when the player enters the area, and set a uniform depending on the player's position so that I could then gradually decrease the alpha of pixels in a widening radius over time. If I had some GLSL code implementing something like this, I could probably adapt it to Godot's shader language, but I don't think I could write it myself from scratch.

So, given what I've said about my resources, does anyone have advice on implementing this kind of effect?

Feel free to give advice about how you might achieve this effect in Unity or another engine, since I can always adapt that method to Godot.

NOTE: I posted a variant of this question on a Godot forum, but I find that GDSE tends to be more helpful, so I'm also posting a variant of it here.

• I know that this is not an answer to your question, but can help you: the game that you used as example apparently does not use fog: it maybe just disable the torchs on another rooms. Since ilumination come from the torchs, if you turn them off, all the room will be in darkness. If in your game each room has individuals sources of light, it will be handy – 648trindade Aug 9 '18 at 12:55