Raytracer
Jan 2002 - Download Source
This was my ray-tracer. Before I knew better, I had an idea of it running in real time.. But ray tracing is far to slow for that.
It's a one file wonder, except for the header file, that's not really a header file.. I sure learnt a lot..
The maths was a little tricky. You basically need to find the intersection point of a vertex and a plane, and then normals to planes. Once you have that the rest is number crunching. I was quite happy with the visual results.. The life span of rays was small they would leave the "eye" and hit a surface. Then that point would be tested for intersections from rays cast by all the lights.. So No reflections, or any fancy effects like that.
All lights were spots, I managed to add a fade off to give the light a nicer soft soft edge.
I did add anti aliasing (5 point per pixcel), that helped smooth over the low resolution I was working in (320x200). I've blown up the images so they can be seen when clicked on.
All in all, I was quite happy with it.. and much tweaking was done.. I doubt you will be able to build the source code because it used DirectDraw, but should be adaptable to any graphics library that offers direct access to textures.
permanent link to this page : http://mrdavec.com/graphics/raytracer

