Ray Tracer

Course Dates (2 days):

Course Hours:

  • 9:30am-5:30pm US Central Time/Chicago

Cost:

  • $250

Instructor: David Beazley

Other Courses | FAQ


This course was part of the Summer of Rust. That has come and gone, but you can still work the project on your own! Your task would be to work through the Ray Tracing Project, converting C++ code to Rust as you best see fit. When you are done, you can compare your work to my "best effort" solution that I posted on GitHub. I'm more than happy to answer your questions if asked on the GitHub project.

I recently recorded a two-part seven-hour live-coding video of working through this project. You can watch it here!

Overview

In this 2-day project course, you'll practice Rust by writing a ray tracer in it. In short, we'll work through Peter Shirley's Ray Tracing in One Weekend project. At the end, you'll get to look at some pretty pictures!

All of the code samples in the "Ray Tracing in One Weekend" book are presented in fairly plain C++. Thus, much of our challenge involves translating this to equivalent code in Rust. Much of this work is straightforward. Some of it more subtle and requires a bit careful thought. Thus, this is a good first project for getting your feet wet and exploring some of the notable differences between more conventional programming languages and Rust.

What to Expect

This is a nuts and bolts project where you'll ultimately write about 800 lines of Rust spread across ten different files. The following major Rust concepts will be involved:

The book starts out with fairly simple code and gradually evolves it into something more advanced through various refactoring steps. This often breaks everything. Thus, you'll be challenged to think about the design of the code, understand the resulting compiler error messages, and figure out how to put everything back together again.

Target Audience

This course is for intermediate programmers who want to expand their Rust skills on a moderately sized project. You don't need to have much prior Rust experience, but the project will be much easier if you already know some basic material concerning syntax, primitive datatypes, functions, and project setup.

Also, be aware that the project involves quite a few mathematical calculations involving trignometry and physics. You don't have to understand all of the math to be successful with the project as code is shown for everything that you need. However, there may be times where you'll be staring at a weird image and then squinting at the screen while you cross-check your calculations between the C++ solution and Rust.

Instruction Format

We'll start by talking about some of the Rust fundamentals needed to implement the project. From there, we'll attempt to follow along in the same order as the ray tracing tutorial. Expect a significant amount of coding intermixed with group discussion. There are no powerpoint slides. This is not a passive course.

Why?

Writing a ray tracer is a project that involves both data structures and mathematical calculations. It is also very computationally expensive. Since Rust is often pitched as a low-level systems programming language to replace C++, this can be an interesting project to undertake if you are interested in comparing the two languages--both in terms of programming style and performance.

Depending on time and interest, a ray tracer is a project that is highly suitable for parallelism across multiple CPU cores. So, that is also a possible avenue of exploration.

About the Instructor

This course is taught by David Beazley. David is probably best known in the Python world as the author of Python Distilled (Addison Wesley) and the Python Cookbook, 3rd Edition (O'Reilly Media). You might be wondering what would qualify him to teach a Rust course, but David is also a former University Professor, having formerly taught Operating Systems, Compilers, and Networks at the University of Chicago. In 2023 and 2024, he taught Programming Languages with Shriram Krishnamurthi at Brown University.


Copyright (C) 2005-2026, David Beazley