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 3.2.3

This is the v3.2.3 release of Ray Tracing in One Weekend, released December 2020. We are finalizing the v4.0.0 release, currently in alpha, which we are planning to complete by the end of 2023. This v3 release is still available for readers who are in the middle of their own implementations, but for new readers, we strongly recommend that you instead use the v4-alpha version for your new ray tracing journey.

You can currently find both the v4-alpha and the v3 versions available in the same project, though we will be removing the v3 content when v4.0.0 is finally ready.

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.