|
(c) 2010 Chris Killpack. |
The raytracer is written entirely in JavaScript. It uses an HTML5 canvas element to display the image, which is managed by Processing.js. In time I will be removing the Processing code.
The raytracer currently supports plane, sphere and box primitives, a material system, multiple lights and multi-sampling in image space. Over time interactive features will be added. |
To me the most interesting part of this raytracer is not that it is written in JavaScript. I wrote it in JavaScript because it's my preferred language of the moment -- it's very quick to iterate in, and distribution is trivial. The quick speed of iteration allows me to play with design ideas, none of which are groundbreaking, but are just things I'm trying to do cleanly. I'm still working out details, but once they are nailed down I'll discuss them below.
A quick preview: image sampling implemented as a Strategy via an Iterator-style API; a Renderman-style illuminate() loop; and composite Materials. I'd also like to experiment with HTML5's Web Workers, and maybe turn this into a JavaScript benchmark of some sort.
Code: I've released the source code on GitHub under the MIT license.