Ray Tracing in One Weekend

The Book Series

Ray Tracing in One Weekend Ray Tracing: The Next Week Ray Tracing: The Rest Of Your Life

Version 4.0.0-alpha.1

The v4.0.0-alpha.1 release, announced for SIGGRAPH 2023, is now available for public consumption, and succeeds our now three-year-old v3.2.3 version, released December 2020. We've saved up this release for many significant updates to the book series, and are now recommending that readers use this version if possible. For a summary of changes, see the CHANGELOG. Please log all issues and suggestions on the GitHub issues page for our project.

If you still wish to use v3.2.3 until the final v4 release, you can find it in the v3/ directory until we ship the v4.0.0 final version.

Getting the Books

The Ray Tracing in One Weekend series of books are now available to the public for free online. They are now released under the CC0 license. This means that they are as close to public domain as we can get. (While that also frees you from the requirement of providing attribution, it would help the overall project if you could point back to this web site as a service to other users.)

Hit any of the book cover images above to begin reading. These books are formatted for printing directly from your browser, where you can also (on most browsers) save them as PDF.

Overview

I’ve taught many graphics classes over the years. Often I do them in ray tracing, because you are forced to write all the code but you can still get cool images with no API. I decided to adapt my course notes into a how-to, to get you to a cool program as quickly as possible. It will not be a full-featured ray tracer, but it does have the indirect lighting which has made ray tracing a staple in movies. Follow these steps, and the architecture of the ray tracer you produce will be good for extending to a more extensive ray tracer if you get excited and want to pursue that.

When somebody says “ray tracing” it could mean many things. What I am going to describe is technically a path tracer, and a fairly general one. While the code will be pretty simple (let the computer do the work!) I think you’ll be very happy with the images you can make.

In Ray Tracing in One Weekend, you will build a simple brute-force path tracer. Continuing with Ray Tracing: The Next Week, you will add textures, volumes (like fog), rectangles, instances, lights, and support for lots of objects using a bounding volume hierarchy (BVH). Finally, with Ray Tracing: The Rest Of Your Life, we'll dive into the math of creating a very serious ray tracer.

When you are done, you should be ready to start messing with the many serious commercial ray tracers underlying the movie and product-design industries.

Source Code

Source code for each book may be found in the GitHub repository: https://github.com/RayTracing/raytracing.github.io. You can also directly download the latest version of the entire project (all three books) as a single archive file:

Issues

You can browse book suggestions and errors in GitHub issues. If you have a suggestion or believe you've found an error, please check these issues first (including closed ones) to ensure that it hasn't already been reported. If it hasn't, please create a new entry, describing the problem, book or source file, location, and whatever other information would be helpful in understanding why you think it's a problem. If possible, include ideas about what you think the fix should look like.

Contributing

Interested in helping out? Please read the guidelines in the CONTRIBUTING.md document first. Pull requests without associated issues, or submitted without coordination, are highly likely to be rejected.