It took me a while to figure out how to make a multi-pass multi-source 2D shader pipeline in Godot. Using Viewports with HDR, CanvasLayers, Sprites (with RGBA32 texture built by script) and mostly ViewportTextures as sampler2D, I've finally manage to make a fluid simulation entirely on GPU. For this, I use Navier-Stokes equation as described in this fabulous papers from the INRIA. I've also attempted to incorporate another equation described in this paper from the University of California, Irvine in order to make the fog a bit smoky, with mitigate success.
One "big" step was to use the walkable tilemap and its associated collision shapes to compute an extruded normal map that provides fluid emission. A bit of gravity has been added too, as well as fixed emitters, acting as smoke guns.
But ! It's not finished yet. The final step is to add perturbation induced by the players, so they can "play" with the fog, or at least interact with the fluid.
Given the simplicity of the Navier-Stokes fluid simulation (due to its approximations), the whole effect doesn't slow down the rendering. The lag you will see in the beginning of the video is due to poor video encoding.
My biggest concern is that it need to initiate and stabilize before looking great. It takes ~ 10 seconds. Perhaps it could be resolved with a waiting screen and a progress bar :sweat_smile:
Many things are not shown here. For the moment, all the characters have their super abilities that can be triggered by double tapping in certain directions. One of them needs to be revised as it's a bit overkill.
See you in a couple of days to show the final result of the fog with interaction with players.