Raytracing with Image_3D - Kore Nordmann

Raytracing with Image_3D

I wasn't sure to blog about this, because you must think I am totally wacky now. But, on the other hand, you surely already think this, so that this won't cause any changes.

Raytraced image with Image_3DRaytraced image with Image_3D

I was always writing, that implementing a raytracer (or the better german description ) in PHP would be far to slow. And then, two days ago, I had the feeling I should prove this ... this was also the way Image_3D was born. With the infrastructure Image_3D offers, all the existing models, the abstraction etc. it wasn't such a big thing. You mainly need to write a short algorithm which gets the intersection point for a polygon with a line, and that's it. For sure, you should optimze the algorithm a bit. :-) And it is really fun to implement such a simple mathematical model like raytracing is.

Some features, hard to implement with the normal renderers, are no problem with raytracing, like:

But I have to admit, the image took about 7 minutes to render with the raytracer on my machine. Let's see this as a prove for PHP beeing to slow for a raytracer. ;-) If you are google and have thousands of computers, you can perhaps even use PHP for raytracing ... but as always, there is really no valid reason to use PHP for generation of any 3d graphics, respectively I don't know any.

One good thing about implementing the raytracer was, that I discovered several minor bugs in Image_3D - mainly an error in the enlightenment code, so that the colors shouldn't look so pale any more. While fixing, some funny errors occured, like this one toby metioned yesterday.

As always this code is in CVS and will be in version 0.5 - but there is still quite a long way to go before Image_3D can be beta.