News for hackers. Stuff that matters.
Re:WebAssembly Raytracer by zurn on Saturday December 16, 2017 @07:21AM (#15939233)
Interesting that there is a 1000x speed difference (0.1 vs 100 ms, in Chrome) between the shader and the JS/WebASM versions even with just Intel integrated graphics.
Re:WebAssembly Raytracer by Klathmon on Saturday December 16, 2017 @08:15AM (#15939397)
Even after working with them for a while, GPUs still feel like cheating. They are just so goddamn good at what they do.

That kind of speed up isn't just a fluke here, it's pretty normal when your work aligns with what a GPU does best.

Re:WebAssembly Raytracer by roywiggins on Saturday December 16, 2017 @05:27PM (#15942567)
They're really fast even if you're sort of abusing them. Using fragment shaders to render entire scenes ("two triangle" style) probably wasn't what GPUs were built to do but the technique is awfully effective.

I mean: https://www.shadertoy.com/view/Mt2yzK

Re:WebAssembly Raytracer by gmueckl on Saturday December 16, 2017 @11:48AM (#15940275)
I've been working with GPUs for many years now and I still get surprised by their performance: some things turn out to be so bloody fast that I initially think that i must do something wrong. Other times, CPU implementations run circles around the GPU for no obvious reason. It's not intuitive and I still have a hard time wrapping my head around how fast these things are when they are at their best.
Re:WebAssembly Raytracer by pjmlp on Saturday December 16, 2017 @11:24AM (#15940178)
It is a complete different way of working, but sometimes it just feels like going back to Amiga coding with Blitter and DMA.
Re:WebAssembly Raytracer by andybak on Saturday December 16, 2017 @08:15AM (#15939398)
It was would interesting to compare a C or Assembly version against a shader version. My hunch is that this is just a use case where a general purpose CPU is left in the dust by a modern GPU.
Re:WebAssembly Raytracer by simooooo on Saturday December 16, 2017 @11:56PM (#15944212)
A shader is just taking advantage of the GPU parallelism. Would still wreck C++ implementation.
Re:WebAssembly Raytracer by singularity2001 on Saturday December 16, 2017 @09:53AM (#15939761)
the emscripten.cpp is pretty much c?
Re:WebAssembly Raytracer by singularity2001 on Saturday December 16, 2017 @10:21AM (#15939893)
oh you mean outside of the browser. yes that would be interesting
Re:WebAssembly Raytracer by andybak on Saturday December 16, 2017 @02:00PM (#15941169)
Yep. That's what I meant.
Re:WebAssembly Raytracer by modeless on Saturday December 16, 2017 @03:18PM (#15941769)
The GPU version is much faster, but I doubt it's that much. I suspect the actual rendering time is not being measured because it happens asynchronously.

Still though, the potential for using GPUs to accelerate computations is high and I think too often overlooked by web developers, even those doing image processing.