[sharing is fun] Fluid simulation on the GPU
Attached is a Max patch that implements a simple fluid simulation using gen – jit.gl.pix. The simulation runs on the GPU and improves speed comparing to the MSA Fluid java version.
In this exemple, the fluid is controlled using an optical flow shader (from Andrew Benson) applied on the live camera image. The source colors are given by a background "mask" image; you can also create static obstacles by sending an obstacle mask texture (dynamic obstacles that takes into account obstacle velocities are not implemented in this exemple).
Boundary Conditions are managed within a 1 pixel border that is added to the source textures and removed before displaying the simulation : if you choose a resolution of 320×240, the real size of the simulation is 322×242.
The fluid algorithm uses 20 Jacobi iterations (40 will be better); this part of the algorithm is very heavy on frame rate and the most efficient (and inelegant) solution I’ve found was to put 20 jit.gl.pix modules in series. If some jitter gurus know a better way to do iteration, or to improve the efficiency of this exemple, I will be happy to update this patch.
: I have fixed a bug into the patcher, fluid_gpu1.zip is the correct one
this is genuinely awesome. will study. thanks.
Very impressive and nice.
Only problem is that on my MBP Retina, Max UI freezes when I open the camera (but the patch keeps on running, so I can see the fluids in jit.window).
Thanks for sharing.
wow very cool, tanks man !
Sweet Jesus that’s awesome!
Wonderful, thanks a lot!
Demonstrates the power of the Jitter dance !!!
Thanks and respect
I’m totally in love with this, really clarifies optical flow for me, but I may have found a bug. Has anyone used it with Yosemite yet? The patch is fine on Maverick but in Yosemite there appears a continuous "current" from left to right across the window, as if something is continuously moving in front of the cam. The jit.grab feed shows no unique noise. Any idea what would cause this glitch?
I’m on Yosemite and get the same left to right flow. Don’t have Mavericks anymore so I can’t see how it is supposed to be, but it is very cool anyways! Seems there are still some critical openGL bugs to iron out, though I get the same flow in Max6 in Yosemete.
thank for share , problem here i think ,, is few ppl like to share Jitter patch , i m an artist share is gold FOR ART, important is not fx, but what happen in GENERAL Idea IN CONTENT
problem here i think ,, is few ppl like to share Jitter patch
been looking at the links from this thread for months, but never said thank you because I didn’t want to bump this thread to anyone else’s awareness for reasons similar to what luxi said. This is one of the best rare finds on these forums, I guess I might as well just say ‘Thank You’ at this point. Thank You.
@JESSERICKE, @CHRISTOPHER OVERSTREET: In the patcher there is a trick to add borders before computing fluid and remove them after. This trick uses the fact that with jit.gl.pix you can have 2 inputs with different dims. I’ve encountered this issue on a Mac Pro with AMD FirePro, and maybe with Yosemite the same problem occurs. If someone knows how to do this differently, I will be happy to know how, because I use this trick in different situations.
I will try soon to make a patcher without the add border feature and post it here.
I am an artist in the classical sense
Picasso and Braque
had a studio in the same room
both two great artists painted canvas
identical no1 could understand what was Picasso
or what was Braque
the two artists were laughing at this
Today it seems that the art
becomes jealous copyright
but this is not art
but another thing
I am a big fan of Anton von Werner. He was a great Artist! He didn’t care much about FX himself. In his villa at the Wannsee, he had locked some young boys doing all the boring work for him! So he could contemplate more about the General Idea, the Content! Compared to him, Picasso and Braque were only dilettants. These guys still did lots of FX by themselves and believed that art had some relation to its medium.
were born in Italy
a master and many boys
help him in th project.
An example Raffaello Sanzio
in the Vatican rooms "Raphael Rooms"
Raphael call about 20 young artist
each one had his ability
in a sector
the project was develop by Raphael
when Raphael died at age 37
these guys could not produce anything else so important, like before
The art is a journey for awareness
FX are only 0,1 content idea is 99,9
- This reply was modified 5 months by luxi.
Hi CMJ. Thanks for the reply. I’m still getting acclimated to pix and gen and such things, and certainly can’t recommend a better technique. But I look forward to the updated patch and anything else you’re working on. For someone new to script like myself, such patches are very instructive.
thanks for the patch! any luck with updating it to yosemite? any ideas how to fix the continuous flow? thanks again, zb
Forums > Jitter