94 points · by vjeux · 14y ago · 25 comments
And here's yet another JS raytracer: http://www.syntensity.com/static/raytrace.html
HN comments: http://news.ycombinator.com/item?id=2884141
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.
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.
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 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.