This fluid variation plays with simple water refraction / displacement map.
I remembered using this technique from which I learnt from this gamedev article.
Obviously, I should be doing a simple ripple simulation instead of this more intensive "Stable Fluids" simulation, however I just wanted to see what the effect is.
Well, what can I say, not very water like, but maybe its like playing with a sticky fluid (like Aloe Vera Gel).
Experimens with JS Fluid Simulation.
- Uses parallel Typed Arrays
- Uses Typed Arrays with Canvas's image data
Jos Stam's GDC03 paper, the source of many references online for fluid simulation code
However a little hard to read, so fluid for dummies might give a little explaination to the code.
Fortunately, Stam's has some presentation slides which is more useful for anyone to wish to understand the thinking behind his algorithms which is much easier for reading too.
Probably the better thing (which I only later on found out), was that there was accompanying source code. It kinds of re-checks my code for bugs, even though it was mostly lifted from his paper.
I dont claim to have done this really well. Oliver's simple fluid dynamics simulator is close but optimized port of Jos Stam's code.