[HN Gopher] Liquid Layers
       ___________________________________________________________________
        
       Liquid Layers
        
       For more context, background see author's posts here:
       https://twitter.com/kotsoft
        
       Author : nmstoker
       Score  : 232 points
       Date   : 2024-06-23 08:43 UTC (3 days ago)
        
 (HTM) web link (grantkot.com)
 (TXT) w3m dump (grantkot.com)
        
       | Nzen wrote:
       | tl;dr this is a liquid simulation toy. This starts with four
       | colors of different densities (so they self-organize into
       | layers). Clicking allows scooping up a ball of the liquid. I
       | consider this pretty to watch, like a laval lamp that I can also
       | throw globs of.
        
         | TeMPOraL wrote:
         | You also have a settings UI, where you can change (among many
         | other things) what clicking does. I find it most interesting to
         | switch to "repel" - the repulsion forcefield turns to be an
         | universal tool for mixing and separating the different liquids,
         | depending on how fast and precisely you operate it.
         | Fascinating.
        
           | kotsoft wrote:
           | With keyboard there are also the shortcuts: 1-4 to emit the
           | different materials a/r to attract repel from mouse x/c to
           | rotate a bit
        
       | yayitswei wrote:
       | Super fun to resize the window and watch the liquid slosh into
       | the new space.
        
         | ssl-3 wrote:
         | Super fun on mobile to dig into the settings and turn on the
         | accelerometer and gyro, and give the phone a twist and a shake.
        
       | hopfog wrote:
       | The author is also working on a really impressive voxel physics
       | engine: https://youtu.be/3259aycYcek
        
         | pornel wrote:
         | I'm surprised the simulation is run on the CPU! This problem
         | has solutions that fit the GPU well, even for grid<>particle
         | conversions.
        
           | troglobite wrote:
           | this kind of sims are better suited for CPU ;-), gpu are good
           | to work on meshes, not really on pure particles. At GPU are
           | super good for grid based hydro.
        
       | BugsJustFindMe wrote:
       | Are there compressible liquids? I'm seeing the whole thing bounce
       | like the layers are compressing.
        
         | pornel wrote:
         | This is a common and difficult problem when simulating fluids
         | using particles.
         | 
         | It's possible to simulate using a grid instead, and that
         | computes pressure very precisely, but it has a downside of
         | adding inaccurate viscosity.
         | 
         | And there are tricks that combine both approaches to balance
         | out the errors.
        
       | whisk wrote:
       | Super fun!
        
       | amelius wrote:
       | Was hoping for accurate simulation of laminar flow.
        
       | sBqQu3U0wH wrote:
       | Cool, the performance is significantly better than the previous
       | time. Or is it a different kind of simulation?
        
         | kotsoft wrote:
         | This is still the same kind of simulation, based on the
         | Particle-based Viscoelastic Fluid Simulation paper. I updated
         | it to use Wasm SIMD more fully with the help of Clang Vector
         | Extensions, Compiler Explorer and Wasm Analyzer. Compiler
         | explorer to play around with patterns and Wasm Analyzer to
         | double check the final compilation.
        
           | eigenvalue wrote:
           | Really awesome work. The WASM lets you show this off to a
           | massively larger audience than a regular binary. I'd
           | encourage you to make your Voxel project also using WASM,
           | then you can easily turn it into a mobile/tablet game.
        
             | kotsoft wrote:
             | Thanks! I am definitely working on bringing more to the
             | WASM world. I'd begun experimenting with 3D and
             | multithreading and then last week decided to circle back to
             | the 2d demo and polish it up a bit more.
        
       | imzadi wrote:
       | This is interesting. I wish the other interactions were as
       | dramatic as the drag one. You have to really crank up the brush
       | size to see anything interesting.
        
       | troglobite wrote:
       | Awesome!
        
       | hermitcrab wrote:
       | This is really impressive. Especially the performance in a
       | browser.
        
       | sphars wrote:
       | FYI, in the Interaction settings you can enable accelerometer and
       | use gyro. Lots of fun on mobile devices! Works well for me on
       | Android/Firefox
        
       | shinze wrote:
       | Impressive
        
       | d--b wrote:
       | I really wish these were 3D simulations. The 2D ones are always a
       | bit off to me...
        
       | miohtama wrote:
       | iPad accelerometer is 90 degrees off
        
       | vanderZwan wrote:
       | Wasn't this shared a week/few weeks ago? Not that I mind it being
       | posted again, just that if it was already posted it might be
       | worth linking the old thread, in case there was some interesting
       | discussion there.
        
         | kotsoft wrote:
         | Yes, the previous one is:
         | https://news.ycombinator.com/item?id=40429878 There are some
         | new features since then and some major speed improvements from
         | using SIMD. I do still see complaints about the compressibility
         | so I still need to work on some improvements for that. (dev)
        
           | vanderZwan wrote:
           | Thank you for digging up the link! And the bonus "release
           | notes" ;)
        
       ___________________________________________________________________
       (page generated 2024-06-26 23:00 UTC)