new ofxMSAFluid with hardcore optimizations & demo with TUIO

I"ve just uploaded a new version of ofxMSAFluid.
http://www.memo.tv/ofxmsafluid

Now I"ve included an example, so hopefully that should demonstrate how to use the addon. The demo also has tuio support (you’ll need ofxTuio and ofxOsc) and you can play with the parameters in realtime using a gui (I’m using ofxSimpleGuiToo which is based on Todd’s ofxSimpleGui API - more info on that at in the post).

And quite importantly, thanks to the beauty of open-source, now the lib is radically faster. Programmer & artiste extraordinaire Emmanuel Maa has done some serious optimizations so that the solver runs 10% - 100% faster!

This is great! I am using it now and WOW is it fast! It is definitely a testament to this great community!

I’m wanting to map the flows to a wall with objects on them, (ie paintings, art) and have the flows react to the objects by adding a mask or something similar. What would be the best way to do this with your code. Thanks for your help!

Peace,
Matt

Hey, that is something that i’ve been wanting to do for a while but haven’t had time. And now Maa is thinking about doing it. For that you need a BOOL array, one per cell, and in it you put full or empty, and then in SetBoundary you act accordingly. With Maa we were talking about having it as a BYTE array instead of a BOOL array, so you can have semipermeable cells as well. I have no idea when he’ll have time to do it, so if you wanna tackle it, have a go…

Still learning but I am going to give it a shot! I’ll keep y’all updated. :smiley:

The performance is amazing. I’m running on a 5 year old laptop and the demo runs beautifully. Good performance, good code, a nice demo - I’m out of excuses not to get into this. :slight_smile:
Thanks for all the effort!!

hi memo
this looks amazing!!!
but i can’t seem to download, your googlecode says you have no downloads (here: http://code.google.com/p/ofxmsaof/downloads/list ), am i missing something? is this the wrong place?

you can access by svn here:

http://ofxmsaof.googlecode.com/svn/trunk/

best

so many goodies in there! :slight_smile: thanks

thats awsome! thx for posting memo.
runs beautifully.
swear the performance has doubled since I ran your previous version.

yea with some settings (color diffusion set to 0) performance is about double! Otherwise there is still a 10%-%20 performance gain. That’s all thanks to Maa. You can compare the current version to say last week’s to see what he’s done.

There is yet another version on the SVN btw (added a few minutes ago), this has a tiny more optimization, a potential bug fix, and options to enable wrapping on X and/or Y (instead of bouncing back) - all courtesy of Maa again!

i can’t wait for see the example :frowning:

anyone can put a video with the example, i cant compile for the moment and have very much curiosity…

Congratulations again…

Check of Memo’s site:
http://www.memo.tv/ofxmsafluid

Peace,
Matt

hi memo,

im using ofxMSAFluid in a project im working on at the moment.
when i switch to black and white mode, i notice that when i move the mouse around it periodically adds white fluid and then it adds black fluid… does that make sense?
it looks like it cycles through a colour spectrum…
for my purpose i need it always to produce white fluid.

is there an easy way of doing this?

thanks,
L.

Hi Julapy, I don’t have the source in front of me now, but it should be in the testApp.cpp, in the addForceSomethingOrWhatever function, there is a bit where the color is calculated (just search for msaColor). You can replace that color selection behaviour with your own (e.g. always insert white or light grey)

ah awsome!
too easy.

thx.

Hi all,

while working with the fluids on a project, i’ve noticed occasional moments of slowdown where everything moves at maybe 1/10th its normal speed for a few seconds before returning to normal. I’m not sure if this is something in the fluid code, or something i’ve created myself (i made some changes to the code, which may have broken some stuff…)
has anyone else ever experienced this?

cheers.

in the past I’ve experienced this (not with ofxMSAfluid, but with a different jos stam implementation) with floating point numbers becoming nans or something bad like that. the operations get very slow. you might want to check if there are float arrays in use, and if so, track very small or very large values to keep them from becoming nans.

hope that helps!
zach

i tired hunting for NaNs in the float arrays, but didn’t catch anything. is there a simple way to configure codeblocks or xcode to exit the app on catching a NaN?

at least i came up with a viable workaround. When i’m not drawing fluids on the screen, i reset the fluid objects.

i also noticed this when porting the jos stam algorithm to oF. not sure, but i think it can be related with some problem damian told about some days ago in another post called denormal bug.

the problem is not with nan but with very small numbers, it seems processors switch to some special mode to do calculations with those that is much slower than the normal one.

there’s some solutions on google, but i suppose by not letting the values in the density and forces arrays going below some number or just making those equal to 0 will do.

Hey, if you did switch these “infinitessimally small” numbers to zero, it might result in disappearance of force. You might want to try a scaling system, where you adjust values upon putting them into the system, so the internal values do not trip the processor into this “slower mode”, and readjust for extraction, similar to forgoing the use of the square-root function when comparing greater distance. Then, such “small” numbers would only be processed upon insertion and extraction, and other operations involving the extracted number.