Skip to content
This is a ray tracer written in Rust designed from "Ray Tracing in One Weekend"
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

weekend ray tracer

Build Status


This is a toy ray tracer written in Rust, following "Ray Tracing in One Weekend"


Spheres shaded by their normals with no antialiasing

Spheres, shaded by their normals, with no antialiasing

Spheres shaded by their normals with antialiasing

Spheres, shaded by their normals, with antialiasing

Mirror spheres

Mirror spheres, no gamma correction

diffuse sphere

Lambertian spheres, with gamma correction

lambertian, mirror spheres

Lambertian and mirror spheres


I used these sources for reference and inspiration to help me with this project. For the more core ray-tracing part, I used the classic book Ray Tracing in One Weekend. I also referenced a tutorial on writing a ray tracer in Rust, since I wanted to make sure I was using proper Rust conventions when writing this.

For the rendering side, I referenced the classic pbrt book, as well as information from Dartmouth's CS87 rendering course, taught by Wojciech Jarosz.

I'm also using nalgebra as my linear algebra library.


To run tests:

cargo test

To build:

RUSTFLAGS="-C target-cpu=native" cargo build --release

To run:

RUSTFLAGS="-C target-cpu=native" cargo run --release

In order for the renderer to be able to output images, you will need to create the output folder, otherwise it will panic and fail.

mkdir renders
You can’t perform that action at this time.