Hacker News new | ask | show | jobs
by DanielRibeiro 4392 days ago
It is not using the GPU to do the drawing: https://github.com/hunterloftis/playfuljs/blob/master/conten...

Note that it is using canvas 2d rather than canvas 3d (aka WebGL[1]).

But if you take ray casting to extreme, you end up with Ray Tracing[2], which is kinda expensive. Which is why we had such an effusive conversation a few months ago about hardware accelerated RayTracing[3].

A sample ray traced scene from AlteredQualia[4] (2nd largest[5] contributor to the famous Three.js Library): http://alteredqualia.com/three/examples/raytracer_sandbox_re...

[1] https://developer.mozilla.org/en-US/docs/Web/WebGL/Getting_s...

[2] http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29

[3] https://news.ycombinator.com/item?id=7425303

[4] https://github.com/alteredq

[5] https://github.com/mrdocob/three.js/graphs/contributors

1 comments

2D canvas should be hw accelerated too on most browsers.
Yes, however the raycasting is drawing pixel by pixel. That part is not hardware accelerated, and that is the expensive part. That is that part that shaders speedup a lot, by delegating a lot of the work to the GPU.

Just compare with this pure fragment shader demo: https://www.shadertoy.com/view/MsS3W3

That page froze my browser (Firefox 29) and started leaking oodles of memory until I killed it (along with a bunch of other shit I was working on), so I guess I'll count that as a point in favor of software raycasting.