Mar 25, 2009
Real time ray tracing using Alchemy
It goes without saying that ray tracing is a slow art. The calculations involved with lighting, reflection, and shadows are done individually on each pixel, and that taxes the CPU tremendously. Regardless, I wanted to see what kind of speeds you could get using Alchemy.
I ran across SuperJer’s ray tracing renderer PixelMachine a while ago. The images it can produce are gorgeous, and always reminded me of Texas Group : Keyboarders (winning 4k demo at NVScene 08). Porting it to Flash with Alchemy took a couple hours of painless modification.
The resulting demo reseeds (based on system clock) and renders a 500×375 image in relatively fast times (will completely depend on your system specs). Occasionally, Alchemy will throw a stack overflow error, but I suppose that’s to be expected with the number of calculations going on. It is still in beta after all.




Great work! It really looks great when by chance you have an overview of the whole scene
Ya, it’s not that useful, but it sure is pretty.
as i saw the title of this post on my rssreader i thought “omg, this’ gonna be awesome”…
then i took a look at the experiment and, yep, it is!
i hope a good raytracer will come with the alchemyzation of papervision or other 3d engine, however this is a first step to see it actually is possible.
thx for experimenting peter,
and thx for sharing the source
Great work
I wonder how single plane perspective corrected distortions would work in Alchemy – could you get a better result than native FP10 3D translations, and then feed back into a 3D engine?
Hats off! Keep pushing the limits
Hi Peter, good work. I too got inspired by PixelMachine and decided to write my own raytracer from scratch using AS3. Just about at a stage where I’m quite happy with it, this is just an AS3 version, not Alchemy, but the performance isn’t too bad. With a few objects on the screen I have a demo of it running in real time with 50×50 pixels.
Anyway I tried to document my journey into the flash world of raytracing on my blog, its on my blog (http://experimentalized.blogspot.com).
Again great work on porting it.
Sam
[...] Si tenéis curiosidad, estos raytracers son interesantes: · http://www.strille.net/works/as3/raytracer/ · http://www.laserpirate.com/as3raytracer · http://www.peternitsch.net/blog/?p=182 [...]