All projects

Ray Tracing in One Weekend

A pure C99 implementation of the ray tracer from Peter Shirley's Ray Tracing in One Weekend, built with CMake and running down to a PSP 3000.

Started
June 2025
Language
C99
Build
CMake, CPM.cmake
Platforms
Linux, macOS, Windows, PSP
  • Ray Tracing in One Weekend

Ray Tracing in One Weekend

1 / 2

A C99 implementation of the ray tracer from Peter Shirley’s Ray Tracing in One Weekend. It follows the book’s progression step by step, in plain, portable C instead of C++, and writes the result to a PNG.

Features

  • Pure C99: no C++ features to lean on, so vectors, materials and the camera are all plain structs and functions
  • Cross-platform: builds on Linux, macOS and Windows, with CI on GitHub Actions
  • Runs on a PSP 3000

Tech

  • C99
  • CMake 3.26+ with CPM.cmake for dependencies

What I learned

  • Translating the book’s C++ class hierarchy into C99 structs and function tables.
  • Where a CPU ray tracer spends its time, and what that means on constrained hardware.