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.
Currently, I just have black
ColorRects connected to an
Area2D and I animate their transparency when the player enters the area. But this is nowhere near as satisfying as what you see in the Gungeon clip.
So, 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 Godot. 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 adapted it to Godot's shader language, but I don't think I could write it myself from scratch.