castleman.space

Thomas Castleman's website.

Rustracer

2023

Overview

In late 2022 and early 2023, I worked with Stewart Morris to port the ray tracer we’d implemented in C++ for CS1230 to Rust.

Our ray tracer reads scenefiles that describe the layout, orientation, and material properties of objects arranged in a 3D scene (as well as lighting and camera properties) and renders it as an image.

Supported Features

Our ray tracer supports:

Example Output

Here are some example renders done by our ray tracer:

Testing Framework

Since we were porting an existing project, we were able to leverage the benchmark images used to grade submissions in CS1230 (publicly available here).

I added a test framework that renders each scenefile we have an available benchmark for, and compares the output image with the benchmark. If the difference between the images is determined to be significant, an image diff is rendered and the test case fails.

Each scenefile/image gets its own #[test] function, so Cargo can run them in parallel.

Source

The project source can be found here