Re:Show HN: WebGL Fire Simulation
by Silhouette on Thursday August 18, 2016 @03:07PM
(#12315437)
Warning: may melt your GPU.
You're not wrong. That put a workstation-class GPU in a water-cooled system up about 20 degrees C within a few seconds. And it was still not fast enough to animate smoothly during the more demanding parts later in the sequence.
Re:Show HN: WebGL Fire Simulation
by jharsman on Thursday August 18, 2016 @01:00PM
(#12314226)
Yes, the actual burning fuel part is just random noise, which doesn't look very very good. I mention it as a possible imrpovement under "Better looking fuel".
Re:Show HN: WebGL Fire Simulation
by mrspeaker on Friday August 19, 2016 @01:02AM
(#12318050)
I seem to remember reading a tutorial about making this effect back in the 90s (it was a great series by someone called "Denthor", or something like that). The bottom part of the effect was supposed to be hidden, only showing the flames I think.
Re:Show HN: WebGL Fire Simulation
by steaminghacker on Thursday August 18, 2016 @09:39AM
(#12312367)
do you have a shadertoy version of this for comparison?
i took this one by ozzy https://www.shadertoy.com/view/lsSGWw
and tweaked a few things by hand for optimization. saved a few cycles on the code and increased the iterations to 13, which gives a better result.
Re:Show HN: WebGL Fire Simulation
by jharsman on Thursday August 18, 2016 @09:51AM
(#12312440)
I can't get your example code to work, but that is a completely different technique, ray marching a volume displaced by a noise function. This gives nice 3D-looking flames, but the movement tends to look like a scrolling noise function. And it's harder to use arbitrary burning shapes, my simulation supports drawing anything and it will burn.
Re:Show HN: WebGL Fire Simulation
by steaminghacker on Friday August 19, 2016 @07:24AM
(#12319277)
Sorry, this version wont just paste back as is in shadertoy. Also it needs a random 256x256 bitmap in channel 0. The effect is the same as ozzy's original, except change ITERATIONS to 13 in his code to see the change (which is only slightly better). The other changes were for performance, which i improved slightly.
Warning: may melt your GPU.
You're not wrong. That put a workstation-class GPU in a water-cooled system up about 20 degrees C within a few seconds. And it was still not fast enough to animate smoothly during the more demanding parts later in the sequence.
Awesome effect, though. :-)
BTW did a pure CSS3 fire a while ago too: http://pag.es/fire/test.html
For example the following video: http://physbam.stanford.edu/~fedkiw/animations/fireball.avi
https://twitter.com/kruhft/status/766304583924592640
i took this one by ozzy https://www.shadertoy.com/view/lsSGWw and tweaked a few things by hand for optimization. saved a few cycles on the code and increased the iterations to 13, which gives a better result.
like this:
#define ITERATIONS 13.0 #define SPEED 10.0 #define DISPLACEMENT 0.05 #define YOFFSET 0.1 #define YSCALE 0.25 #define FLAMETONE vec3(50.0, 5.0, 1.0)
https://news.ycombinator.com/newsguidelines.html