Ray Tracer
Write a physically inspired ray tracer from scratch in modern C++ using only the standard library. You build a vector math foundation, cast rays through a virtual camera, intersect spheres and planes, and shade with diffuse, reflective, and shadow rays before writing a PPM image. A rewarding blend of maths, algorithms, and modern C++.
Support Free C++ Education
Help us keep this platform free for everyone! Your support enables us to create more high-quality lessons, exercises, and interactive content.
What You'll Build
A command-line ray tracer that renders a scene of spheres and planes with reflections, shadows, and anti-aliasing, then writes the result to a PPM image file.
Learning Objectives
- Build a 3D vector class with operators and constexpr where useful
- Cast primary rays from a configurable camera through each pixel
- Compute ray-sphere and ray-plane intersections analytically
- Shade surfaces with diffuse lighting, shadows, and reflections
- Model materials and scene objects with polymorphism or std::variant
- Anti-alias by averaging multiple samples per pixel with <random>
- Parallelise rendering across rows with std::thread
Coming Soon
This project is in development. Register your interest and we'll email you the moment it goes live.
No spam. Unsubscribe anytime.
Coming Soon
This project is in development. Register your interest and we'll email you the moment it goes live.
No spam. Unsubscribe anytime.