A step-by-step course that teaches 3D rendering by building a software renderer in about 500 lines of bare C++, with no third-party libraries.
RayTracing/raytracing.github.io
Free online book series that teaches building a ray tracer from scratch in C++, with the full source code for each stage.
- Stars
- 10,719
- Forks
- 1,016
- Open issues
- 81
- Last commit
- 3 months ago
What is it?
Ray Tracing in One Weekend is a three-book series that walks readers through writing a ray tracer step by step. The first book covers the core pipeline and produces a working renderer; the second, The Next Week, adds more advanced rendering features; and the third, The Rest of Your Life, goes further into the underlying techniques.
The repository hosts the books as HTML pages, which are published for free on the web and also available as PDFs for printing. It also contains the final source code for each book, along with the images and figures used in the text, so readers can compare their own implementation against a reference. The code is written in C++11 with a deliberately simple style meant for broad readability rather than optimized performance. The project builds with CMake and outputs images in PPM format.
The source is intended as a companion for checking work rather than a standalone tutorial. The project also lists community implementations of the series in other languages and operating systems.
Key features
- 01Free web-based books covering ray tracing from basics to advanced topics
- 02Complete reference source code for each book's final stage
- 03Printable HTML and PDF formats
- 04Buildable with CMake on Windows, Linux and macOS
- 05Outputs images in PPM format
Use cases
- Learning how a ray tracer works by implementing one yourself
- Checking your own renderer against a known-good reference implementation
- Studying physically based rendering concepts in a hands-on way
Quick start
- 1
Clone the repository from GitHub
- 2
Configure the build with CMake from the project root
cmake -B build - 3
Build all targets
cmake --build build - 4
Run a program and write the image to a PPM file
build\Debug\inOneWeekend > image.ppm
Things to know
- This repository provides reference source code meant for comparing your own work, not a standalone application.
Topics
FAQ
- What is raytracing.github.io?
- Free online book series that teaches building a ray tracer from scratch in C++, with the full source code for each stage. Ray Tracing in One Weekend is a three-book series that walks readers through writing a ray tracer step by step. The first book covers the core pipeline and produces a working renderer; the second, The Next Week, adds more advanced rendering features; and the third, The Rest of Your Life, goes further into the underlying techniques.
- Is raytracing.github.io free to use? What license does it have?
- raytracing.github.io is open source under the CC0-1.0 license. Check the license terms before using it in commercial products.
- Is raytracing.github.io still maintained?
- Updated within 6 months. The last commit to raytracing.github.io was on Aug 10, 2026.
- What can I use raytracing.github.io for?
- Learning how a ray tracer works by implementing one yourself Checking your own renderer against a known-good reference implementation Studying physically based rendering concepts in a hands-on way
- How do I install raytracing.github.io?
- Clone the repository from GitHub Configure the build with CMake from the project root: cmake -B build Build all targets: cmake --build build Run a program and write the image to a PPM file: build\Debug\inOneWeekend > image.ppm
- Where can I get raytracing.github.io?
- The source code and installation instructions are on GitHub: https://github.com/RayTracing/raytracing.github.io
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
pbrt-v4 is the physically based ray tracer from the 4th edition of the Physically Based Rendering book, written in C++.
Blender is a free, open source 3D creation suite covering modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
A free, open-source, illustrated data structures and algorithms textbook with runnable code in more than a dozen programming languages.
A free, open-source book that teaches Vim and Vimscript by focusing on the most useful parts of the editor.
A beta Fabric mod that adds NVIDIA RTX Remix path tracing to Minecraft Java Edition 1.21.1 on GeForce RTX GPUs.