Raytracing

Software

The initial version of the raytracer was developped with python by d-002
Then, i recoded it in C++, and ported it to the AVR-MicroPC with the C/C++ compiler
for more information on the C++ compiler, see the C/C++ compiling page

The raytracer uses a raymatching algorithm to trace the ray, and determines the color of eatch pixels. It support having multiples object, like cubes and spheres., a light , a textured floor, and a colored background.

Performance

At its base frequency (16MHz), the AVR-MicroPC can render a 128x64 image in aproximatly 30 mins using the first raytracer.
Compaired with a classic modern computer, it is very very slow, but it is still impressive for a 16MHz MCU.
My personal computer can render the same image almost insantly at the same resolution, and in less than a second at 1920x1080.

Issues

The AVR-MicroPC has some visual glitch when rendering an image:

The black dots on the image came from the hardware itself, like the breadboard connections, and cheap cables.
these can be avoided with software by sending twice the pixel to the VRAM. This does not increase the render time beacause the pixel is not calculated twice, and sending a pixel takes only a few microseconds.

also, on the right face of the cube, we can see the reflextion of the floor at the top.
This is not normal, and i think it is due to the difference of compiler between the C/C++ compiler and the GCC compiler on my PC. On my PC, the reflextion is not there, and the image is rendered correctly like below:

Also, the background is not the same color, but this is just a different setting.

Other version

d-002 later recoded his raytracer in C++, so I'v ported it again to my C/C++ compiler.
This time, he also improved his algorithm, so the render time is way lower.
For an image with a cube and a spheres, the render time is down to an impressive 50s, and even 40s with a bit of overclocking.