Script.it .Nam Myoho Renghe Kyo.

Script.it
[Lab] Tracing rays #01

Diving into 3D more. I am now learning that drawing lots of triangles on screen can be tedious en performance heavy.
So… while reading up on the subject i came along some posts about raytracing and raymarching.
A technique used in image processing.
raytracing


















You can read all about it here!

This technique seemed cool and interesting to code…
Soooww…., because i cant stand it when i dont know how something works,
i took it upon myself to dive into it. And just get to know the world of raytracing and such.

There are quite a few people posting about this subject but 1 i found most interesting and understandable.
http://www.iquilezles.org/ is the domain of Iñigo Quílez. A very respected guy in the demo scene. His work is awesome, and he has some very good reads on this kind of subject. So after alot of reading and hair pulling i got something that worked and was pure AS3.0. What you see is a rotating cube in 3d space being raytraced by every pixel.

heres the result:
(mouse over to enable )
[SWF]http://blog.rackdoll.nl/wp-content/uploads/2011/11/rm_old.swf, 500,500[/SWF]

So ye..
I had some trouble with the amount of rays and the animation. It was waaay to heavy and this bitmap i could use before it went broke was 50×50 scaled up by 10. In one word awefull. But…. it helped me alot with the getting more insight bit. After this test i had a good idea about the workings behind raytracing.

So now i need more power. I can go for molehill, but the learning curve is just insane. And lets not start about the documentation on that subject. I am all about quick results so i went for pixelbender. Having worked with it in past years i have a rough idea of how to implement this newly found technique. And together with my awesome resource, i had the basic raytracer in pixelbender working. Basicly what you see below is pixelbender doing a ray for every pixel on screen. This shader is being loaded into flash and the image produced from the shader is drawn as bitmapFill in a sprite.

And voila, result #2:
(mouse over to enable )
[SWF]http://blog.rackdoll.nl/wp-content/uploads/2011/11/rm.swf,500,500[/SWF]

Next step is to get some reflections and maybe some raymarching going.
To be continued.

Comments are closed.

Categories
Archives
Live Supporters