peter nitsch.net

peternitsch.net

Real time ray tracing using Alchemy

Ray tracing

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.

Check it out.

Download source.

Category: Flash

Tagged: , , , , , ,

7 Responses

  1. David says:

    Great work! It really looks great when by chance you have an overview of the whole scene :)

  2. Peter Nitsch says:

    Ya, it’s not that useful, but it sure is pretty. :)

  3. 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
    ;)

  4. Ian says:

    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?

  5. sakri says:

    Hats off! Keep pushing the limits :)

  6. Sam Halliday says:

    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

Leave a Reply