Ray tracing is a fascinating algorithm used for image synthesis. I have written a rudimentary ray tracer consisting of more then 5000 lines of code.
The video below shows it render a high resolution triangle mesh representation of the Stanford dragon:
Fast implementations depend on binary trees to reduce the number of required ray triangle intersection computations. These trees are quite beautiful to look at. In a nutshell such trees are generated by splitting a bounding box which contains the object in two recursively again and again. The video below visualizes such a tree:
Please note how the outermost box shows up for high sensitivity values and the splitted sub boxes become visible as the sensitivity is reduced. When it is reduced further, the edges of the dragon become visible nicely.
The same algorithm can also be used for mathematical plotting purposes. Below you can see renderings of a Julia fractal in two and three dimensions, generated using the same ray tracing code:
Interested? Read more:
The source code is freely available at: