Javascript Ray Tracer
fooo.fr
fooo.fr
And here's yet another JS raytracer: http://www.syntensity.com/static/raytrace.html
HN comments: http://news.ycombinator.com/item?id=2884141
Pre-render steps (building the BVH/KDTree, caching transformed geometry, caching textures and building mipmaps) can take 2 hours before the rendering even starts :)
And this is on a machine with 32 i7 cores and 96 GB of RAM.
There's a reason SPI and Weta (and the other CG/VFX companies, although those two have the biggest) have huge renderfarms...
The Amiga was 7mhz. I'm now running quad core i7 2.2ghz, so I'm - what? - 300 times faster on one chip? 1200 times faster potentially? 20 seconds now would have been (20*300) = 6000 seconds, close to 2 hours. I guess this shouldn't be all that shocking, but it is.
On top of that, different rendering algorithms, optimisations, biased-vs-unbiased.
For example, took 12 seconds to render on a quad core i7, but that's 512 unbiased samples per pixel, and 5 bounce global illumination, so that's around 2,013,265,920 rays sent in 12 seconds, which isn't bad.
re: the juggler amiga demo - from http://home.comcast.net/~erniew/juggler.html:
The images were generated with a standard Amiga with 512K memory. A ray tracing method was used, which simulates rays of light reflecting within a mathematically defined scene. Each image requires the calculation of 64,000 light rays and takes approximately 1 hour to generate. An image is compressed to about 10K bytes for storage. Images are expanded in less than 30 milliseconds. The Amiga hold and modify mode is employed so that up to 4096 colors can be displayed at one time.
==============
So... 1 hour for each frame... hrm...
This isn't true at all.
At what point are the equations "accurate"? What margin of error is acceptable?
We still have a long way to go before we can claim accurate lighting equations.
The interlacing is a nice touch too. I shuffled an array of pixels and filled it sequentially.
The low speed is unfortunate though. Any plans for using NaCl or Dart?
Another way to optimize is to make all the ray calculation on the GPU with WebGL shaders. There are a lot of demos of real time small ray tracers. It works well because it's massively parallel and vector operations are hard-wired. The downside is it's harder to debug and you cannot make long operations or it will crash the graphic driver.