ofxMSAFluid (2009)

openFrameworks (C++) demo

 

Processing (Java) demo

 

The source code for the above demos are included with the library as an example to demonstrate how to use the features (including how to interact with the fluid using camera and/or multi-touch screens).

 

 

Some examples from the wild

This library and demo has turned out to be hugely popular and now has a life of its own. Almost every multi-touch / interactive dance / visuals performance I’ve seen uses MSAFluid. Some without even changing the parameters!

(Search for other examples on youtubevimeo or flickr)

MSAFluid is an opensource C++ / Java / AS3 library for solving and displaying real-time 2D fluid simulations based on Navier-Stokes equations.

If your browser supports Java you can play with an interactive online version here.

Download

Java version (for processing) –
github.com/memo/p5-MSAFluid

C++ version (for openFrameworks or Cinder) –
github.com/memo/ofxMSAFluid

AS 3.0 version (ported by Eugene Zatepyakin) –
blog.inspirit.ru/?p=248

Reference

The javadoc reference can be found here. A copy of the reference is also included in the .zip.

License

Released under the MIT License

Acknowledgements

The code is based on Jos Stam’s famous paper -
Real-Time Fluid Dynamics for Games.

The demo was inspired by the brilliant Plasma Pong (even with some advice by the author, Steve Taylor, who pointed me in the direction of Jos Stam’s paper).

A lot of the fluid solving algorithms are from Jos Stam’s paper. I tried to wrap it up in an easy to use API to provide methods for adding and getting forces and color at any position. Other useful resources and implementations I looked at while developing this library are:

and some other Stam solver implementations I’ve come across since writing this are: