This is my take on implementing fluid in WebGL. It’s a direct implementation of “Real-Time Fluid Dynamics for Games” from Jos Stam. The computation is done entirely with shaders, with textures as input and output matrices.

The web app is here. Works better on Chrome than on Firefox.

The source code is here, together with plenty of useful links, and my naive understanding of WebGL pipeline.

My implementation is buggy, I think it does not conserve mass or energy in the system.