i read the article and had exactly the same thought!
especially the part where the falling cells are being rendered as full cells made me go "waaait a minute, this would look slightly weird in exactly the same way that ONI water does when it falls". Does anyone maybe with ONI modding experience insights on wether that's really how the game implemented liquids? The release date certainly wasn't too far off.
Great writeup and a fun exercise to implement by oneself as a learning project.
My favorite 2D liquid simulator is this IOCCC2012 submission [1]... simply astonishing.
That is the source file shown at the beginning of the video... it compiles without warnings, runs a full blown fluid dynamics sim with surface tension and everything, can take itself as its own input... truly a work of art.
I was going to reply this is at least 10 years old and it was already butter smooth the first time I interacted with it (with even older hardware, from when webgl was still a novelty and not widely supported across browsers)
I think it’s way off. It looks surface waves propagate without dispersion — tap it and watch the caustics. Real water haves have the packet of waves and the individual peaks and valleys moving at dramatically different speeds.
This is quite close to Terraria's implementation, earlier versions having the same falling water rendering 'glitch.' It does not implement pressurised water flowing upward on the other hand.
Simple Hooke's Law for Springs worked pretty well [1], even when I generalized to 3D. There much less nodes you have to iterate over to achieve a water effect.
This is great, thanks for sharing. I'm planning on using this, or something similar, in a game I'm developing. It'll be waves of fog, but act like a fluid, and will encroach on simulated ants :)
I'm curious why the simulator never reaches a complete, steady state? It seems to settle mostly and then a few squares flicker rapidly. Is this just floating point math doing its thing, or ?
A falling stream generates outward flow without piling up.
Watch your faucet run into a partially full sink: there’s a small depression where the stream impacts it — while the pressurized region under the stream pushes the water out and away.
This is in contrast to honey, which will form a mound when a stream hits, because of its higher viscosity.
Consider a J-shaped tube, open on both ends. After you add some water to the taller end, the bottom loop fills up. When you add more water, what happens? The water flows downwards even though the cell underneath is full.
That makes sense. The counterintuitive part for me was a cell causing the one underneath to become pressurized and then flowing back up. You don’t usually think of water as compressible.
Also check out wavelet-based water wave simulation for a very close approach to the real thing, by a pioneer in the field of physics simulation in Computer Graphics, Matthias Muller-Fischer:
Same idea: General framework for observer based cellular automata simulation. Invented years ago as a geospatial research.
https://github.com/ulrischa/OCell
Shamelessly sharing some research I worked on a few years ago- Using ML to learn cellular automata which simulate a given system (uses neural cellular automata).
This is neat. Can you explain neural cellular automata? I’m familiar with neural networks and cellular automata. I’ve been interested in DNNs to analyze CAs but is this the other way around?
This seems to be a version of a lattice gas fluid model. (Or, more precisely, lattice-boltzmann, since it allows for fractional values of fluid occupancy per cell.)
I had a Santa Fe institute monograph on this back in the day, and I seem to recall that they ended up using a hexagonal grid, in order to achieve the required isotropy of fluid behaviour. Might be something to consider.
Ha, yup, I enjoyed adding that to the game :)
It was inspired by the system dwarf fortress used at the time extended with pressure to allow equalizing vessels.
No... lattice-boltzmann discritizes the navier stokes equations. This is just a cellular automaton. It uses a small number of rules in order to determine the change of every cell. You can of course conceptualize an eulerian solver of navier stokes as a cellular automata... but this system simply uses a very small set of simple rules to get something that looks right.
75 comments
[ 3.0 ms ] story [ 148 ms ] thread[1]: https://tomforsyth1000.github.io/papers/cellular_automata_fo...
especially the part where the falling cells are being rendered as full cells made me go "waaait a minute, this would look slightly weird in exactly the same way that ONI water does when it falls". Does anyone maybe with ONI modding experience insights on wether that's really how the game implemented liquids? The release date certainly wasn't too far off.
Great writeup and a fun exercise to implement by oneself as a learning project.
That is the source file shown at the beginning of the video... it compiles without warnings, runs a full blown fluid dynamics sim with surface tension and everything, can take itself as its own input... truly a work of art.
[1] https://youtu.be/QMYfkOtYYlg
https://madebyevan.com/webgl-water/
Another classic: http://david.li/fluid/
And indeed it's at least 11 years old according to this youtube video https://www.youtube.com/watch?v=R0O_9bp3EKQ
https://gamedevelopment.tutsplus.com/tutorials/make-a-splash...
https://www.youtube.com/watch?v=nF7cdUVgvNc https://github.com/tterrasson/liquid-simulator-godot/
But as soon as you dive into a tiny bit of detail, no, this violates those equations at basically every iteration.
https://michaelmoroz.github.io/Reintegration-Tracking/
I'm curious why the simulator never reaches a complete, steady state? It seems to settle mostly and then a few squares flicker rapidly. Is this just floating point math doing its thing, or ?
Watch your faucet run into a partially full sink: there’s a small depression where the stream impacts it — while the pressurized region under the stream pushes the water out and away.
This is in contrast to honey, which will form a mound when a stream hits, because of its higher viscosity.
https://www.youtube.com/watch?v=6I6BV0-BVxI
https://github.com/lecopivo/WaterSurfaceWavelets/
Code: https://github.com/PWhiddy/Growing-Neural-Cellular-Automata-...
Demo: https://transdimensional.xyz/projects/neural_ca/index.html
You can get really interesting mixing behaviour by varying the density of the particles - https://en.wikipedia.org/wiki/Rayleigh–Taylor_instability
First questions on my mind : Can it do surface tension? Pressure?