JSRay - Javascript Raytracer

Anonymous Apr 15, 2010 at 14:00


I’ve been working on this little Javascript Raytracer for quite some time. My goal was real-time, knowing that I would likely not succeed, but you have to aim high sometimes. The raytracer now supports spheres, boxes(not rotated…) one plane, a sunlight, point-lights, reflection, anti-aliasing and not much more :). I use very weird techniques to achieve speed-ups, have not implemented any well known methods at all I believe. I tried adding a sort of tree structure but this really hammered the performance, so it was removed again. Possibly the tree only makes sense when scene complexity increases.

Real-time remains fictional, but I have managed to create a preview thats kind of fun. Using the mouse buttons and wheel you can navigate around the scene fairly easily with a low resolution preview to find the spot you would like to render. give it a shot :)

Don’t use Internet Explorer, it really won’t work… Chrome works best.


6 Replies

Please log in or register to post a reply.

TheNut 179 Apr 15, 2010 at 16:03

Nice work. I believe you have the finest ray tracer demo written for the web. You should give this demo to the browser giants and tell them that JavaScript will not be considered fast unless you can render my demo with speeds equivalent to native code ;)

So what are your plans with this? Or simply the web and graphics in general. Any thoughts about building 3d games using similar tech (web 3d or whatnot)?

_rant_ 101 Apr 16, 2010 at 11:21

This is quite impressive, raytracers are like a hobby for me :D It even works on my new HTC, although it would drain power quickly. And something’s wrong with the canvas… but it works :D

fireside 141 Apr 16, 2010 at 12:11

Very cool. Moving around in low res was a good idea, but I think it should have possibly diverted to just low everything also because when I tried some of the higher things, it slowed down when moving around.

marcgfx 101 Apr 16, 2010 at 15:57

thanks for the comments :) . yeah, I’ll have microsoft get IE up to date, wouldn’t that be fine! my

plans were to maybe once make a small game with rendered graphics online, but… currently that doesnt seem to be an option :) it would be possible with some kind of faked raytracing though, might look into that :) . have some more javascript fun in the pipeline, no raytracing involved there though, stay tuned!

legloups 101 Apr 16, 2010 at 19:57

Impressive as to raytracer, very good work :)

rouncer 103 Apr 18, 2010 at 07:15

Beautiful shot you picked off it, looks like a really pretty story book.