[HN Gopher] WebGL Fluid Experiment (2014)
       ___________________________________________________________________
        
       WebGL Fluid Experiment (2014)
        
       Author : maxraz
       Score  : 182 points
       Date   : 2020-08-05 11:57 UTC (11 hours ago)
        
 (HTM) web link (haxiomic.github.io)
 (TXT) w3m dump (haxiomic.github.io)
        
       | haxiomic wrote:
       | Hey, I feel bad for not updating this demo in 6 years! Back then
       | it wouldn't run on iOS, today it could run with no trouble
       | 
       | For people on iOS, here's another version with rainbow colors and
       | multi-touch https://haxiomic.github.io/demos/rainbow-
       | fluid/index.html
       | 
       | If you like this sort of thing and want to learn more about it I
       | recommend checking out https://www.shadertoy.com/ for more demos
       | and https://thebookofshaders.com/ for tutorials
       | 
       | And if GPU simulations is your thing then I think you'll enjoy
       | what these two amazing guys are doing with shaders:
       | 
       | - https://www.shadertoy.com/user/michael0884
       | 
       | - https://www.shadertoy.com/user/wyatt
        
         | seesawtron wrote:
         | This is beautiful. Can you say how this is different from [0]
         | if at all in terms of implementation?
         | 
         | [0] https://paveldogreat.github.io/WebGL-Fluid-Simulation/
        
           | haxiomic wrote:
           | Similar implementation from a physics perspective - Pavel
           | uses the same technique for simulating Navier-Stokes (Jo Stam
           | Real-Time Fluid Dynamics for Games [0]). Pavel's has an extra
           | step to enhance vorticity which gives you those higher detail
           | swirls and uses a slightly different approach for input
           | 
           | The big difference is in the rendering however, Pavel has
           | added light shafts and bloom which are really neat effects.
           | Additionally, he actually got round to publishing a native
           | app which I think has been great for him!
           | 
           | [0] https://pdfs.semanticscholar.org/847f/819a4ea14bd789aca8b
           | c88...
        
         | nitrogen wrote:
         | FWIW the rainbow link gives this console error in Firefox on a
         | Surface Book with Intel graphics:                   Uncaught
         | TypeError: rgHalfFloatLinear is null
         | 
         | I assume that means it doesn't support 16-bit float pixel
         | formats; maybe this is something that could be detected and
         | shown as an error message in the page?
         | 
         | The original HN link works great, though, very cool!
        
           | haxiomic wrote:
           | Ahh that's a shame, yeah looks like 16-bit float textures
           | aren't supported but 32 bit are. Thanks for the heads up - I
           | should really be checking if either are supported here!
        
       | monkeydust wrote:
       | Therapeutic... I mean really.
        
       | blauditore wrote:
       | Tangentially related: For a long time I've always been looking
       | for some software for particle simulations that is free or even
       | open source, easy to get started, and at least somewhat visual.
       | I'm not doing anything like that professionally, just want to
       | play around with a virtual wind tunnel for the fun of it. I'm
       | thinking of something like Blender where I would click together a
       | 3d mesh, "turn on" wind and see what happens.
       | 
       | Does anyone have tips or hints? Are my expectations perhaps
       | unrealistic? I looked into OpenFOAM before but always eventually
       | gave up, as it seems quite heavy on headless, scripted
       | simulation, and would need some significant run-up time.
        
         | eric_t wrote:
         | Associate professor in fluid dynamics here. There is typically
         | a split between the people who want good looking simulations
         | for movies/games, and those who need accurate results for
         | engineering. For engineering, you need more effort on how you
         | resolve the complex geometry and how you model the turbulence
         | in the flow. This adds significant complexity both for problem
         | setup and solution time. The only product I'm aware of that is
         | built for real-time, 3D flow design is Ansys Discovery:
         | https://www.ansys.com/products/3d-design/ansys-discovery
         | 
         | OpenFOAM is high quality, but as you've seen complex to use.
         | There is a web-based GUI that can lighten the burden to get
         | started somewhat: https://www.simscale.com/ I think they give
         | you ~3000 simulation hours for a trial.
        
         | vosper wrote:
         | I've been trying to figure out where I should place a shelter
         | belt on my property, as I've heard that the wind will rise up
         | over the belt and then "dump" downwards. I don't want to
         | position the belt so that the wind dumps on my house. I think
         | it's essentially a fluid dynamics problem (I say this as
         | decidedly not an engineer).
         | 
         | I've only looked half-heartedly, but found nothing that can
         | help me.
        
         | jpm48 wrote:
         | Specifically for fluid (and similar) you could have a play with
         | mantaflow http://mantaflow.com/ it's relatively easy to build
         | (you will need Qt and Python). Houdini (free apprentice version
         | will work for fun) is great for particle effects and this sort
         | of stuff as well https://www.sidefx.com/
        
       | jchw wrote:
       | There is also this one, and the corresponding iOS app (which I
       | have.) It seems to run a bit faster on my phone.
       | 
       | https://paveldogreat.github.io/WebGL-Fluid-Simulation/
        
         | jedimastert wrote:
         | The README links to the original as a reference!
        
       | utf_8x wrote:
       | Damn, the performance on that is really impressive.
        
       | imvetri wrote:
       | ha ha ha, outer space is a simulated fluid.
        
         | imvetri wrote:
         | with that assumption, it gets easier to build an eye observing
         | an eye....observing an eye observing a thing.
        
           | imvetri wrote:
           | Neural network learning models are good, but it scales well
           | only when NN watches a NN watching an NN being trained with a
           | data.
        
             | nullc wrote:
             | To be sure that you're not a NN yourself, I should require
             | you to draw a triangle.
        
               | exikyut wrote:
               | _[Triangle is distorted by unseen fluid]_
        
       | inetsee wrote:
       | The title seems to imply that it needs a touch screen device. It
       | seems to work just fine on my desktop with a mouse.
        
       | suyash wrote:
       | beautifully made!
        
       | designium wrote:
       | That's very fun and relaxing!
        
       | holoduke wrote:
       | just out of curiousity, but how does the algorithm roughly works.
       | does every pixel/particle position gets calculated? or is it
       | optimized by smart grouping? is the GPU used for paralell
       | computing? very interesting stuff to heavily optimize I guess.
        
       | dang wrote:
       | Discussed at the time:
       | https://news.ycombinator.com/item?id=8502477
       | 
       | also https://news.ycombinator.com/item?id=8325700
        
       | madjam002 wrote:
       | Nice, the effect reminds me of Powder Game (https://dan-
       | ball.jp/en/javagame/dust/)
        
         | otterpop wrote:
         | At least give me some warning before you link to it; I'm gonna
         | be playing it all day today :)
        
           | ljf wrote:
           | Man there was some game similar to this called Sand Sand
           | Sand, that I was totally addicted to. I showed my kid
           | recently and he loved it too, timeless fun!
        
             | thedrbrian wrote:
             | There's also the stand alone Powder Toy which has more
             | powders and saves and such
             | 
             | https://powdertoy.co.uk/
        
               | snazz wrote:
               | And the modern web-based incarnation Sandspiel, which was
               | extremely popular on HN a while ago:
               | https://news.ycombinator.com/item?id=18696291
        
         | hansoolo wrote:
         | Awesome!
        
       | kipple wrote:
       | At first I expected this to be some new version, but nope, it's
       | the original. I love that this repo[0] hasn't been touched
       | significantly in 6 years and it's still going strong.
       | 
       | [0] https://github.com/haxiomic/GPU-Fluid-Experiments
        
         | soylentgraham wrote:
         | Given that the original commit is clearly a giant copy&pasta
         | from somewhere else, not surprised there is little development
         | or changes as time goes on
        
           | soylentgraham wrote:
           | Oh, my bad, this the copy&pasta one
           | https://paveldogreat.github.io/WebGL-Fluid-Simulation/
        
             | jchw wrote:
             | Trying to figure out what you are suggesting with the
             | copy/paste stuff. I looked at the first few commits in both
             | the PavelDoGreat repo and the haxiomic repo and see no
             | obvious signs of copypaste. PavelDoGreat's initial commits
             | start with initializing WebGL, seems reasonable. haxiomic's
             | starts with a README and then a code drop, again, doesn't
             | seem too unexpected. I also doubt one took from the other
             | since one is Haxe and the other is JS.
        
             | monkeydust wrote:
             | That's the one I was thinking of, thank you.
        
       | peacefulhat wrote:
       | iOS not supported. Ridiculous that iOS doesn't support WebGL 2.0
        
         | ry4nolson wrote:
         | https://news.ycombinator.com/item?id=24062471
        
       | Razengan wrote:
       | Would be even more fun if such things (including the Powder Game)
       | were also affected by device
       | orientation/gyroscope/accelerometers.
        
       | nemacol wrote:
       | This is fantastic. Runs really smooth, the color and design looks
       | wonderful. I could lose few afternoons playing with this thing.
       | 
       | Looking forward to the app. Would be fun to manipulate the sim by
       | moving my iPad around.
       | 
       | Potentially fun ideas...
       | 
       | Allow me to place shapes/blocks down and lock them in place to
       | see how the fluid moves around them.
       | 
       | Let me put a small 'pump' in the liquid to keep constant or
       | pulsed movement. add a couple dials for pump speed, etc. I want
       | to put two pumps facing one another and watch the interaction
       | where they meet.
       | 
       | Different pool shapes - round, star, sphere?
       | 
       | Allow for particles to reach the edge of the pool to fall off and
       | then let me drop new ones into flowing water.
       | 
       | Loads of fun. Thank you!
        
       | _ZeD_ wrote:
       | It reminds me of http://minimal.be/lab/fluGL/index80000.html
        
       | codetrotter wrote:
       | Doesn't support iOS
        
         | lawlessone wrote:
         | Or does iOS not support it?
        
         | gen3 wrote:
         | Here's one that works on iOS. It also has an app.
         | https://paveldogreat.github.io/WebGL-Fluid-Simulation/
        
       | Ataraxy wrote:
       | Very satisfying effect.
        
       | octernion wrote:
       | i'm constantly amazed at what can be done with webgl these day
       | (shame about the iOS support). surprised we don't see more
       | immersive games with this tech!
        
       | LoSboccacc wrote:
       | all these simulators out there and still not one remake of plasma
       | pong
        
         | tyingq wrote:
         | http://anirudhjoshi.github.io/fluid_table_tennis/
         | 
         | No good for mobile, but perhaps someone could fix that.
        
           | exikyut wrote:
           | There's a paid Android app linked from that page. You are
           | technically correct that the [free] webpage indeed not work
           | on mobile.
        
             | LoSboccacc wrote:
             | I'm fine with non free thanks both for the links and the
             | tips!
        
         | faitswulff wrote:
         | I truly miss this game sometimes. Is it still available
         | anywhere?
        
           | dspillett wrote:
           | The rights owners for pong (Atari?) had it and any mirrors
           | they could find taken down.
           | 
           | A quick search suggests that there are downloadable copies
           | out there. 1.3c was the latest release. Check WayBackMachine
           | from 2007-Sep-13 (https://web.archive.org/web/20070913204145/
           | http://www.plasma...) or older if you want more info, after
           | that the site is an "Atari told us to take this down" message
           | for a while and is currently held by someone else talking
           | about other games.
        
       ___________________________________________________________________
       (page generated 2020-08-05 23:01 UTC)