Raytracer in C

By: Gijs Bellaard


Inspired by friends having to make a raytracer in C for an university course, I made a simple toy raytracer in C. The code can be found here. I tried to make the code as readable as possible for didactic purposes. Compiling and running is easy.

$ gcc main.c -o main.exe -Ofast -Wall
$ ./main.exe > image.ppm

A precompiled executable can be found here. The output is a .ppm file which can be viewed with, for example, IrfanView.