Look at the following picture :

It's a classic raytraced image with reflecting spheres. Not impressed? Let me
enumerate the features of the raytracer which rendered it :- Sub-pixel accuracy
- Cast shadows
- Recursive reflection
- Arbitrary number of spheres
- Arbitrary number of omnidirectional light sources
- Reads the scene definition from a text file
- Produces 24 bit PBM images of arbitrary size
- 100% written in C++, without using any external library
Still not impressed? What if I told you the complete source code is 2092 bytes long?
Yes, it's not a typo. Two thousand and ninety-two bytes. And it could be reduced a little more in expense of "clarity".
You can download the source code along with the scene file that produces the above output and a fully commented version of the source. It produces PBM output so might have to convert it to a readable format. An example, using the netpbm tools :
g++ -o minirt minirt.cpp
cat scene | ./minirt > output.ppm
Enjoy!
Back to developers area