ofxFlowTools: optical flow, fluid dynamics and particles in GLSL


#1

Hi All

I wanted to anounce that after months of work I have finally finished the ofxFlowTools addon.
This addon combines optical flow, fluid dynamics and particles in GLSL.

The beta version was part of ‘Hidden Features’ a dance performance by Antoine July in Dusseldorf. It worked like crazy!

Here is a short introduction video

Hope some of you guys have fun with it!
Cheers!
Matthias


#2

Wow, very nice! Thanks for sharing!


#3

This looks amazing!


#4

Wow, nice work !
I will have a look on it.


#5

Excellent addon, thanks a lot.
Is there a way to quantify how much of the image changed between two frames ? ftOpticalFlow::getAverageFlow always seem to return 0


#6

That is weird.
Haven’t used that function in a long time though.
I’ll look into it.


#7

Found a bug where the width and height were not set properly.
Fixed now.


#8

great,
just had one problem when compiling in windows + codeblocks

file ftFluidSimulation.h line 77 :

void setDensityFromPressure() {return densityFromPressure.get();}

is returning a value but the function is defined to void,
i guessed it should be a setter like :

void setDensityFromPressure() {densityFromPressure.set();}

but it not sure what parameter to pass, so for a quick fix i just set the function to return a float and it compiled apparently without problems.


#9

you can remove void setDensityFromPressure() {return densityFromPressure.get();} its already apeared in file ftFluidSimulation.h line 96


#10

didnt see that , thanks…


#11

Fixed in src.

Good to know it works under windows. (i did not test that yet)


#12

Yeah ! A very nice fluid/particles system, i’m going to try it ! Thanks man


#13

First test with audience:


#15

Updated flowtools to be compatible with OpenGL3.
Also added a Visual Studio example.

There are still some small bugs to work out:
There is a problem with the timeblur using openGL3 in Visual Studio.
And I got problems with blending behaving differently using openGL3 in Xcode.

Any suggestions are welcome.

Cheers!


#16

Nice Addon, seems you put a lot of effort into it.
What was your setup in the video? I assume back projection onto the surfaces. But where are the Cameras?


#17

IR Camera’s were in the front (about 5 meters from the screens and 3 meter high)
IR lights (pars with filters) were above the audience


#19

This looks amazing man, nice work! Can’t wait to play with it :smile:


#20

moostrik,

This addon is great! I compiled and ran the Windows sample using VS14 without any issues.

One question: How do I change the blue (left click) and orange (right click) colors?

I searched through the C++ and shader sources and couldn’t find where these two colors are set…

-Rob


#21

These colors are created by (first) drawing them into a texture using ftDrawForce and (second) adding this texture to the density of the fluid sim. (line 221:)

fluid.addDensity(flexDrawForces[i].getTextureReference(), strength);

The ftDrawForce has a setForce(ofVec4f(0,0,0,0)) method that sets a the force. If the ftDrawForceType is FT_DENSITY the setforce will behave more or less as ofFloatColor, where x,y,z,w translate to r,g,b,a

You can change this force in the gui of the example, go to:

  1. mouse left button

    • draw full res
    • force

    x = red
    y = green
    z = blue
    w = alpha

You can also change the type of the force here
non/den/vel/tem/prs/ob:
non = no force
den = density (color)
vel = velocity
tem = temperature
ob = obstacle

Each mouse button has multiple forces connected to it of which the first is in high resolution (draw full res) for use with density (which in this simulation translates to color).
The other two are in the resolution of the simulation (usually a quarter of the full resolution).


#22

OK, great thanks! I’ll test this out…

-Rob