Re:Recursive raytracer in 35 lines of JavaScript
by reirob on Tuesday November 19, 2013 @06:45AM
(#6760519)
Thanks for sharing this. Especially on the page there is a presentation as well as several ports of this same program to other languages like OCaml, Haskell and JavaScript. Interesting to see that the OCaml version is on par with the C++ version performance wise, but is 47% shorter. However the Haskell version is not shorter and 4.5 times slower?
Re:Recursive raytracer in 35 lines of JavaScript
by thenomad on Tuesday November 19, 2013 @07:29AM
(#6760659)
And here's a comparison between that (smallpt) and the equivalent (smallptGPU) using a GPU:
http://davibu.interfree.it/opencl/smallptgpu/smallptGPU.html
All VERY interesting stuff.
Re:Recursive raytracer in 35 lines of JavaScript
by hxa7241 on Tuesday November 19, 2013 @09:18AM
(#6761257)
And if you like that (spheres only), you might also like this (general triangles-based), in 444 lines of Scala (and OCaml, Python, Ruby, Lua, Scheme, C++, and C):
Re:Recursive raytracer in 35 lines of JavaScript
by 1gn1t10n on Tuesday November 19, 2013 @09:42AM
(#6761399)
All this reminds me of Paul Heckbert's ray tracer written on the back of his business card:
http://www.cs.cmu.edu/~ph/src/minray/minray.card.c
http://www.kevinbeason.com/smallpt/ (+ source code and explanation)