Fluid physics in particles OpenFrameworks


In ATS 3135 Interactive Art && Creative Coding Fall 2015 with @bakercp we created a particle system very much based on the examples the chapter about object oriented programming in the ofBook. We furthered the example by adding velocity to the particles based on ofMousePressed, ofGetMouseX&Y, and ofGetPreviousMouseX&Y so that when the mouse is pressed and dragged, it would effect the velocity and direction of which the particles would go based on their distance from the mouseX&Y. The class was then tasked to further the example in any way they pleased, with some example ideas of what to further the example with.

I wanted to further my example by using some kind of fluid simulation reaction by the particles when the mouse is dragged through the window, like this.

In my research I found that there were | already | multiple | openFrameworks addons built for fluid simulation. I also found that one person in particular modeled their openFrameworks example of fluid simulation from a research paper written about the fluid physics and a small example of simulating said physics written in C, which is awesome.

I’m not nearly adept enough to implement these into my particle sketch yet, but I did want to share my findings with others.


Also here is another cool fluid simulator that even has open source versions of itself in JS, Java, and Python.


Plasma pong here we come :wink:


For a slightly different approach, check out liquid fun.

There are openFrameworks addons out there to make it easier to get started. It’s built on Box2D.