
HTML5 Fluid Simulation in WebGL - junto
https://haxiomic.github.io/GPU-Fluid-Experiments/html5/?q=UltraHigh
======
lucaspiller
Previous discussion from 37 days ago:

[https://news.ycombinator.com/item?id=8325700](https://news.ycombinator.com/item?id=8325700)

------
bshimmin
Beautiful.

I also find this a good test of Apple's bold claims about the speed increase
in the latest version of Safari - and, true to what they say, it does seem
smoother in Safari, at ultra-high, than in Chrome.

~~~
zabcik
Well not in my safari. It crashes as soon as I try to click on the particles.

------
KhalilK
Though it looks awesome, It's spamming my console with WebGL errors:

    
    
        [.WebGLRenderingContext]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawArrays: framebuffer incomplete (clear)
        [.WebGLRenderingContext]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawArrays: framebuffer incomplete (check)
        WebGL: too many errors, no more errors will be reported to the console for this context.

~~~
haxiomic
I'm not getting these, what's the browser?

~~~
KhalilK
Chrome V38.0.2125.104 on 64-bit Ubuntu 14.04

~~~
exDM69
What GPU/driver are you using?

This looks like either a driver bug or some unsupported combination of pixel
formats.

Unfortunately, WebGL doesn't solve these compatibility issues that are
inherent to OpenGL and running on a wide variety of hardware and drivers.

~~~
KhalilK
I see.

    
    
       product: 2nd Generation Core Processor Family Integrated Graphics Controller
       vendor: Intel Corporation
       driver=i915

~~~
exDM69
Unfortunately, that generation of Intel GPUs is known to be quite bad in
performance and having very buggy OpenGL drivers.

I don't know if that's the cause of the issue you're seeing but don't expect
to run any fancy 3D on Linux with that GPU.

~~~
zurn
It is the same driver as the later Intel models. It is one of the very few
drivers that are not blacklisted by Chrome on Linux, owing to its unbugginess.

~~~
exDM69
I know, but that doesn't mean that there aren't bugs or missing features
specific to that GPU model (hardware or software). But I can't be sure whether
this particular issue is a driver bug or just an unsupported combination of
pixel formats (FRAMEBUFFER_INCOMPLETE hints at that).

WebGL spec requires certain of pixel formats to be supported but either the
test case is using some combination that isn't guaranteed to be supported or
the driver+hw combination doesn't actually support everything required by the
spec.

Intel has made huge improvements since the days of the i9xx series of GPUs.
They were miserably bad from a programmer's standpoint.

------
phkahler
Is this fake physics or real? How deep is the fluid, what methods are used
etc...

Looks really neat.

~~~
haxiomic
It's solving the incompressible form of the Navier-Stokes equations, it's very
barebones however - I've left out diffusion for example. It's possible to
reduce the grid size and increase the solver iterations to have a more
physically accurate simulation, but to go down that route I think there are a
lot of algorithmic improvements that should be made

------
B5geek
This is amazing, thank-you. I would love to see the addition/option of adding
static geometric shapes. In other words this would make for an awesome wind-
tunnel simulator.

~~~
haxiomic
This has been a common request, so I'm definitely going to be adding these
features in

------
sokrates
As a complete physics noob, can I mod this to work in 3D? I.e. model a concave
rigid body shape, and have the fluid flow around it?

~~~
haxiomic
The mathematics generalizes to 3D quite easily, but the way the webgl pipeline
is used in this case doesn't. It'd be easier I think to start from scratch. I
recommend reading through the GPU Gem's article on the topic with code samples

[http://http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html](http://http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html)

although the physics is discussed, you don't need to follow it deeply to
implement it

------
rawland
Great stuff! Kudos to George Corney (haxiomic), the creator!

Chromium 38.0.2071.0 (279972) works fine in whatever setting on a medium sized
machine.

------
dochtman
It doesn't seem to do anything for me with Firefox Nightly/Yosemite on my
recent rMBP. Nothing in the console, either.

~~~
raverbashing
Did you click and drag?

~~~
dochtman
No, doh.

Still, maybe a little hint could work to improve usability in this sense?

~~~
Hengjie
I agree, took a while to figure out what was going on. Especially because the
grid lines are so tiny with such low contrast.

------
sandmanxc
These things make me genuinely happy.

~~~
evilliam
Me too. Especially as it's Haxe (Actionscript 3) rendering out to JS / HTML

I'm hoping this goes more mainstream

------
nikentic
Tells me "WebGL is not supported" on MBP Yosemite - Latest chrome version.

~~~
haxiomic
Strange! I'll look into this, what about safari?

~~~
M4v3R
For me, it works even smoother on Safari 8.0/Yosemite on 13" rMBP 2013.

------
reedlaw
Chromium: "WebGL is not supported"

Firefox: laggy on UtlraLow settings

I've wanted to get behind WebGL for so long but if it can't work as well as
the OpenGL ES running on my phone then I will just have to wait and see if it
gets any better.

~~~
mhandley
That odd - it works fluidly (!) on High setting on my mid 2010 Mac Mini
running 10.10 and using Firefox 33, and pretty well on Ultra High setting.

~~~
reedlaw
I get about 2-3 FPS on Firefox 33 for Linux. Could be the Nouveau driver. The
Nvidia driver slows down Firefox so I can't switch back.

~~~
ccozan
How would a kernel driver slow down a browser? And nvidia runs incredibly
smooth on Linux, even on older hardware.

~~~
reedlaw
Beats me. I've filed issues with both Firefox[1] and Gnome[2].

1\.
[https://bugzilla.mozilla.org/show_bug.cgi?id=1065236](https://bugzilla.mozilla.org/show_bug.cgi?id=1065236)

2\.
[https://bugzilla.gnome.org/show_bug.cgi?id=736669](https://bugzilla.gnome.org/show_bug.cgi?id=736669)

------
hardwaresofton
This is really trippy/amazing looking. I love it.

