[HN Gopher] WebGL Fluid Simulation
       ___________________________________________________________________
        
       WebGL Fluid Simulation
        
       Author : ChadNauseam
       Score  : 338 points
       Date   : 2024-12-29 04:39 UTC (18 hours ago)
        
 (HTM) web link (paveldogreat.github.io)
 (TXT) w3m dump (paveldogreat.github.io)
        
       | jcims wrote:
       | I don't know why but I always find these high resolution physics
       | simulations/eye candy to the thing that really blows my mind
       | about how much processing is done inside of a cpu/gpu. I watched
       | a two minute short earlier today from the cockpit of a plane
       | declaring an emergency and needing to take a runway at an airport
       | and it wasn't until right at the end that I realized the video
       | wasn't real...it was from a simulator or video game of some kind.
       | Yet still seeing swirly colors on a screen still is what does it
       | for me.
       | 
       | Weird.
        
       | kittikitti wrote:
       | This was so cool! I really liked creating a spiral and circling
       | it faster and faster. Maybe this could be visualized with a PC
       | build and the fan airflow?
        
       | theLegionWithin wrote:
       | damn, that's neat
        
       | lovegrenoble wrote:
       | https://news.ycombinator.com/item?id=19963640
       | 
       | https://news.ycombinator.com/item?id=23955527
        
         | big-chungus4 wrote:
         | https://news.ycombinator.com/item?id=40903849
         | 
         | https://news.ycombinator.com/item?id=34422948
         | 
         | https://news.ycombinator.com/item?id=32051941
         | 
         | https://news.ycombinator.com/item?id=25031304
         | 
         | https://news.ycombinator.com/item?id=23955527
         | 
         | https://news.ycombinator.com/item?id=19963640
        
       | lovegrenoble wrote:
       | Previous discussions:
       | https://news.ycombinator.com/item?id=25031304
        
       | omoikane wrote:
       | oimo.io also has a few WebGL fluid simuations, via this thread:
       | 
       | https://news.ycombinator.com/item?id=37026592 - Water
       | (2023-08-06, 133 comments)
       | 
       | https://oimo.io/works/water/
       | 
       | https://oimo.io/works/water3d/
       | 
       | https://oimo.io/works/fluid/
        
       | hyperation wrote:
       | Being able to right click, Save image as.. is awesome.
        
       | tlarkworthy wrote:
       | I have a fork of this that inverts the light model from additive
       | to subtractive and suddenly its like ink in water
       | 
       | https://observablehq.com/@tomlarkworthy/ink
        
         | doctorhandshake wrote:
         | This was the first thing I did when I wrote a fluid sim as well
         | - I've spent a ton of time and energy pursuing ways to get
         | subtractive color effects (the richness and light-subjectivity
         | of pigment) in digital artifacts and have mostly come up empty,
         | but I take every chance I can get.
        
           | snaily wrote:
           | Have you checked out mixbox[0]? The outputs do feel
           | intuitively "right" as someone who has dabbled in watercolor,
           | and the paper/videos cover the thinking and Kubelka-Munk
           | theory well.
           | 
           | [0] https://github.com/scrtwpns/mixbox
        
         | popalchemist wrote:
         | How difficult would it be to prevent the ink from disappearing?
         | Any tips would be appreciated, I'd love to integrate this into
         | a drawing app.
        
         | SiggyF wrote:
         | You could consider changing your ink to CMYK colors: `mutable
         | ink = [255, 0, 255]`.
        
       | keepamovin wrote:
       | If I stir a cup (or even a rectangle) of water, it will start
       | swirling. Why does this not swirl? Local chaos, dissipates
       | quickly, bulk flow does not sustain.
        
         | block_dagger wrote:
         | Swirls on my phone.
        
           | keepamovin wrote:
           | I tried phone, similar. I guess it kind of does keep
           | rotating, but you can't see it. Colors fade faster than flow.
           | 
           | If you dab a finger in the stream at right angles to the flow
           | you made, the splash flows the expected way, but maybe slower
           | than water.
           | 
           | It would be good to visualize _any_ flow. And also to respond
           | to device orientation so you can feed the resonance :)
        
       | brundolf wrote:
       | I think this actually produces HDR on my iPhone 15 Pro, which
       | really makes it pop because not a lot of things do
       | 
       | Very cool!
        
         | geek_at wrote:
         | It looks really nice and is very smooth.. But a subscription
         | for a fluid dynamic app, really?
        
           | jonplackett wrote:
           | They gave you a free web version. So if they want to try and
           | do a subscription of charge $30 for a one off purchase I
           | think that's up to them. I'm curious if anyone will ever buy
           | a subscription or spend $30 though.
        
             | tlarkworthy wrote:
             | I tried it as a background on Android but it killed my
             | battery within hours so I stopped. Shame, its so cool.
        
               | jonplackett wrote:
               | I bet your phone doubled as a nice hand warmer though
        
       | swazzy wrote:
       | Sebastian Lague recently created a related video for those
       | interested in rendering fluids:
       | https://www.youtube.com/watch?v=kOkfC5fLfgE
        
       | naich wrote:
       | The first time I've actually appreciated my laptop's touch
       | screen.
        
       | klener wrote:
       | Does anyone know of more examples of water simulations in WebGL?
       | I'm looking for ways to implement waves with foam.
       | 
       | I love Evan's Pool demo. https://madebyevan.com/webgl-water/
        
         | hirako2000 wrote:
         | Was reading somewhere that one isn't a simulation. Rather super
         | clever tricks to make it look like water, swimming pool, a
         | thing in it.
        
       | MPSimmons wrote:
       | I have an HDR monitor and OMG it's so bright it's almost painful.
       | So beautiful!
        
       | lukew3 wrote:
       | Woah, that's pretty
        
       | Falimonda wrote:
       | This reminds me of Plasma Pong!
       | 
       | It would be a shame if you implemented a free online version of
       | it ;)
        
         | chamomeal wrote:
         | Plasma pong was AMAZING thanks for unlocking that memory!!
        
         | jeffhuys wrote:
         | Oh wow yeah!
        
         | Edd314159 wrote:
         | This reminded me of a game but I couldn't remember which one. I
         | opened this comment thread hoping someone would know, and you
         | delivered. Thank you!
        
       | Mossly wrote:
       | I'll always have a soft spot for this earlier implementation
       | which at lower resolutions has a kind of cyberpunk netrunner
       | aesthetic, and at higher resolutions an almost ethereal ghostlike
       | quality: https://haxiomic.github.io/projects/webgl-fluid-and-
       | particle...
        
         | Mossly wrote:
         | hey there's even a comment from 2020 where the creator of that
         | project talks about this project, neat! I always wondered if
         | they were connected in some way or independent applications of
         | the same underlying premise:
         | https://news.ycombinator.com/item?id=24065857
        
         | sujayakar wrote:
         | I love playing with it at UltraHigh quality and 1 solver
         | iterations. It reminds me of gradually incorporating one
         | ingredient into another when cooking: like incorporating flour
         | into eggs when making pasta.
        
       | paulpauper wrote:
       | all from Newton's equations...
        
         | hirako2000 wrote:
         | Is that not navier-stokes ?
        
       | offsky wrote:
       | I would love to see a lava lamp simulator with this type of
       | quality. I've tried before to make one but alas I don't have the
       | math.
        
       | who-shot-jr wrote:
       | I am utterly amazed by people who can do stuff like this.
        
       | neuroelectron wrote:
       | Reminds me a lot of Smoke Winamp plugin from Geisswerks. Looks
       | almost identical, actually. Pretty sure he used GPU acceleration
       | to write it back when that was a pretty rare feature for 2D
       | effects.
       | 
       | http://www.geisswerks.com/about_smoke.html
        
       | hirako2000 wrote:
       | How about 3D? Is there at least an equation to solve that yet?
        
       | joshchernoff wrote:
       | This is great!
        
       | gyomu wrote:
       | Can someone explain what kind of fluid this is simulating?
       | Obviously it implements the general Navier-Stokes fluid
       | equations, but if I twirl some ink in a cup of water it looks
       | nothing like this so I'm confused by the naming.
       | 
       | Is it a scale issue? When I look at the sea it doesn't look much
       | like this either, so I don't think so?
       | 
       | Is there a combination of parameters I could set in the
       | simulation such that it looks like what I see when I pour myself
       | a glass of water, or watch waves at the beach?
       | 
       | Or is it because all the real world examples I'm referencing are
       | 3D, and this is 2d?
        
       ___________________________________________________________________
       (page generated 2024-12-29 23:00 UTC)