WebGL Fluid Simulation
paveldogreat.github.io
paveldogreat.github.io
A simpler one, and without fancy lighting, but with a code walkthrough/tute http://jamie-wong.com/2016/08/05/webgl-fluid-simulation/ ... also doesn't work on my phone. :(
For what it's worth, the Github page references to the GPU Gems book for this effect: http://developer.download.nvidia.com/books/HTML/gpugems/gpug...
Density diffusion: just a hair under 1(visually)
velocity diffusion: 0.99
pressure: 0.93
vorticity: 5
Also, just setting Density Diffusion to 1 and leaving makes the movement slow enough to be able to screenshot nice wallpapers.
It was like a webpage as a wall paper.
Maybe ahead of it's time as it crashed constantly...
Too bad Apple doesn't move forward with WebGL2 and Google splits the community in 2 with webgpu.
WebGL while impressive, still fails to keep up with what native 3D APIs are capable of.
It's not splitting the community. They needed a new modern API like what people behind Vulkan did.
And OpenGL ES is already at 3.2.
With WebGL, in my current projects, the limiting factors are the network, javascript and RAM more than the opengl driver overhead...Maybe the reason behind it is to find common grounds with Apple and supports several investment around Stadia's core technologies?
I don't know enough about fluid dynamics to be the judge, but it seems like the engine is using genuine (2D) physics and it's not just "toy physics." Could someone who knows fluid mechanics comment on this?
[1] https://en.wikipedia.org/wiki/Projection_method_(fluid_dynam...
The numerical methods for solving the PDEs that computer graphics folks use would surely be considered primitive by someone who develops engineering computational fluid dynamics softwares.
Fluid simulations for science or engineering (think airflow around the next Boeing design or simulations of planet formation) are still very hard. And that is not because physicists are stupid, bad at coding or easily replaced with machine learning.
It's just the basic second order central difference. It also uses a first order approximation to the Dirichlet and Neumann boundaries, so that additional error will diffuse throughout the simulation region. It doesn't use any approximation tricks for square roots etc., so given appropriate floating point semantics (as a physicist I have no clue what the shader language specifies there) you can still get realistic and accurate results by reducing the spatial and time steps, which is easily doable for a small 2D simulation on modern GPUs.
Ultimately, though, all the basic "best practices" for simulations of this kind - staggered grids, higher order derivative approximations, etc. - aren't very complicated and are well described in any CFD textbook. What really makes engineering CFD software complicated are things like handling complex geometries with dynamically refined meshes, efficiently solving the resulting linear equation systems at scale and coupling the fluid dynamics to other physical phenomena while retaining numerical stability and accuracy.
http://www.geisswerks.com/milkdrop/
Ryan Geiss' website has some other cool stuff he's worked on:
If I’ll have time for that, maybe I should add custom D3D-specific effects there that weren’t there in the original version. Fluid simulation is one of them. BTW it’s easier to implement with compute shaders. WebGL only support them on Chrome/Chromium and only on desktops, that’s why OP used some trickery with fragment shaders instead.
To have it full screen on mobile, you can use the "add to home screen" feature of your browser"
During my 3rd year at uni I played with webgl1 to create a fake fluid simulation, my demo looks crap nowadays http://jspdown.github.io/mod1/
I met a fellow at Nasa Glen in the 90s that worked on fluid simulations using an sgi workstation. I don’t remember how long the simulations took to process but had to be several minutes per frame. I do remember those workstations cost well over 30 grand at the time.
On a beefy system this could probably handle the full 10 point touch no problem!
I am doing this on a desktop (Arch + Gnome 3) with an Acer touch display.
Well done!
Thanks to the creator.
It can track 10 fingers at once did not even know the iPad could do that.
Looks like it's standard Navier-Stokes.
just a random recommendation: I love to connect this from a laptop to a TV screen, connect a wireless/long cable mouse, and play it with my cousins / little kids. it's a one time trick, but they always love it. (you can do the same with other programs / simulations, just enhancing the experience a little bit can do wonders)
This is really beautiful work.
I suspect the nouveau video driver is the culprit.
I'm currently using Ubuntu 18.04