My C99 implementations of Ray Tracing in One Weekend and Ray Tracing: The Next Week by Peter Shirley, Trevor David Black, Steve Hollasch. My implementation uses tagged unions rather than polymorphism.
You can render the scenes below as follows:
cd ray_tracing_in_one_weekend # or ray_tracing_the_next_week
./scripts/build_release
./build/release/main > image.ppm
open image.ppmThe ray tracer is single-threaded so it will take about an hour to render the
first scene and about three hours to render the second scene. You can speed it
up by by reducing image_width or the number of samples_per_pixel in the
main function, or by choosing a different scene from the list available.
The final image from 'Ray Tracing in One Weekend'
The final image from 'Ray Tracing: The Next Week'
The 'simple light' image demonstrating Perlin noise
The reference 'Cornell Box' image



