Title: smoked brot, a 1 pass fluid solver Post by: eiffie on January 15, 2013, 05:18:58 PM Wanted to play around with a fluid solver to eventually get smoke wafting thru some scenes but CPU versions are too slow and GPU versions generally require a more complex setup than we have in our shader sandboxs so I made this simple 1 pass version. It works better than I expected (I didn't expect much).
http://www.youtube.com/watch?feature=player_detailpage&v=CKpxubhazjQ (http://www.youtube.com/watch?feature=player_detailpage&v=CKpxubhazjQ) It runs much faster than this video, probably too fast on some machines. The code does a few iterations of Navier-Stokes (sorta kinda maybe). It even runs "ok" on 8 bit buffers - at least it doesn't look much worse. For a quick smoke texture I'm happy with it but if anyone has suggestions I'd love to hear them before I convert this to 3d. Title: Re: smoked brot, a 1 pass fluid solver Post by: Kali on January 15, 2013, 06:28:01 PM Very nice and cheap smoke, eiffie! but how could you convert it to 3D using the shader?
Title: Re: smoked brot, a 1 pass fluid solver Post by: eiffie on January 15, 2013, 06:41:18 PM I wouldn't be able to do it in Fragmentarium - I don't think - but in my app there is 3d texture support so you do one 2d slice at a time updating the texture. No longer 1 pass :)
Title: Re: smoked brot, a 1 pass fluid solver Post by: Syntopia on January 15, 2013, 06:50:58 PM Looks great, eiffie!
I wouldn't be able to do it in Fragmentarium - I don't think - but in my app there is 3d texture support so you do one 2d slice at a time updating the texture. No longer 1 pass :) Don't think so, either. As far as I know, there is no way to fill a 3D texture using a single pass. The new GLSL Compute Shaders probably allows it, but my GPU doesn't support them :-( Title: Re: smoked brot, a 1 pass fluid solver Post by: Kali on January 15, 2013, 08:49:03 PM Btw, I made this test using Kaliset formula as smoke and animating it, to produce the effect of a mist blown by the wind. Nothing even close to a fluid solver but... just wanted to hijack your thread because I'm jealous of your work ;D
https://dl.dropbox.com/s/uydsrdafbxfwy1f/smokeanim.swf P.S.: but maybe using distance estimate to the object to somehow modify the smoke could achieve some fluid-like behavior? Title: Re: smoked brot, a 1 pass fluid solver Post by: eiffie on January 16, 2013, 05:45:44 PM Yeah that looks good!! I wonder if you could get swirls by rotating each iteration - smaller and smaller vortices??
I have the 3d version working but it is slow since I don't have the proper buffer setup - I should be rendering into a slice of the 3d texture - beyond what I anticipated using my app for. http://www.youtube.com/watch?feature=player_detailpage&v=kaqOwEIe3Lg (http://www.youtube.com/watch?feature=player_detailpage&v=kaqOwEIe3Lg) Title: Re: smoked brot, a 1 pass fluid solver Post by: knighty on January 16, 2013, 09:24:01 PM Excellent!
:wow: Title: Re: smoked brot, a 1 pass fluid solver Post by: kram1032 on January 16, 2013, 10:42:41 PM Nice! :D
Lol, a good enough (e.g. perfect) solver could be used as a "quick" test for wether the MBulb is closed. Quick of course being highly relative: The calculation times would probably be insane! Title: Looks interesting? Post by: freshNfunky on January 16, 2013, 10:56:26 PM hi eiffie,
downloaded the source must test it in fragmentarium to understand it properly ;) I am also working on some fluid dynamics ideas but which are based on fractals instead of grid based navier-stokes differentail equations. Usually rendering every grid equally is a waste of render time. i would be courious if your algorithm would be anyway faster than real-time... But actually navier stokes is waste of rendertime and the numeric solution is tricky causing divergent situations which create deterministic chaos. i want to go beyound this line with a different approach of the solution using a quasi-analytic method rendering the motion fields of fluids discovered that some very deep misinterpretation is made in fluid mechanics by bernulli in it's flow law which hasn't been questioned properly so far. Here comes the solution why bernoulli confses everybody and no one yet understood why: http://www.youtube.com/v/29h21n-tyfE?hl=de_DE&version=3 GOTO MINUTE 16:00! (There are more Talks in this video. the relevant The talk starts at Minute 16:00) so what comes next on my side? Currently i want to get the idea straight before i start developing an algorithm on it. Would love to discuss this further to lift it so some serious development. There has also been started a thread a few weeks ago: http://www.fractalforums.com/let%27s-collaborate-on-something!/developing-fractal-algorithm-for-fluid-dynamics/ (http://www.fractalforums.com/let%27s-collaborate-on-something!/developing-fractal-algorithm-for-fluid-dynamics/) Title: Re: smoked brot, a 1 pass fluid solver Post by: cKleinhuis on January 17, 2013, 09:19:45 AM i wonder if what kali tried with overlapping sine waves could yield as well turbulences in 3d ... wouldnt it be possible to use just simple overlaying sine waves to create a vortex !? in the 2d water you demonstrated realistic water effects by overlapping sine waves... hmm, i dunno if anything reaaaally simple like that could be done to a 3d vector field to give the cheapest vortexes :D
Title: Re: smoked brot, a 1 pass fluid solver Post by: Syntopia on January 17, 2013, 05:45:46 PM Yeah that looks good!! I wonder if you could get swirls by rotating each iteration - smaller and smaller vortices?? I have the 3d version working but it is slow since I don't have the proper buffer setup - I should be rendering into a slice of the 3d texture - beyond what I anticipated using my app for. Look really good, Eiffie. How do you update/access the 3D texture if you don't render slices? Title: Re: smoked brot, a 1 pass fluid solver Post by: eiffie on January 17, 2013, 06:30:08 PM No I DO render slices but I have to read the pixel data into the 3d texture (on the CPU) and rebind (back to the GPU) after all the slices are complete. A better way is to have 2 frame buffers with 3d textures attached and then render directly into 1 and read from the other - then flip buffers. That would be faster since no data is leaving the GPU. freshNfunky - don't expect anything illuminating coming from my code beyond the simple idea - there's more than one way to skin a cat. I also was able to make a one pass method by sampling the surrounding area. |