Skip to content
Ray tracer written in rust based off of the "Ray Tracing in One Weekend" series.
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
Cargo.lock
Cargo.toml
README.md
earthmap.jpg
rttnw_final_scene.png

README.md

Rustracer - A Path Tracer Written In Rust

This is a basic ray / path tracer written in rust. It is based off of the book Ray Tracing in One Weekend by Peter Shirley, available here.

This repo follows all the way through book two, with the exception that moving spheres were removed.

Usage

cargo run --release > rttnw_final_scene2.png

Performace

This section is based off the first book in the series and applies to the v1.1.1 tag only.

v1.1.1 (Multi Threaded):

After adding support for multi-threading, rustrace is now super duper fast.

Benchmarks:

Computer Info:

  • macOS 10.14.3 (18D109)
  • MacBook Pro (15-inch, 2018)
  • 2.6 GHz Intel Core i7
  • 16 GB 2400 MHz DDR4

Rustracer:

  • Took 19.57 seconds.
  • Run using cargo run --release > image.ppm (Time above subtracts 0.86s build time)

Reference:

  • Took 58.051 seconds.
  • Built using g++ -O3 main.cc -o main

This is an unfair comparison now though because the reference implementation is single threaded.

v1.0.0 (Single Threaded):

Interestingly this implementation is slightly faster than the C++ reference version. By slightly I mean very slightly, they are within seconds of each other.

Benchmarks:

Computer Info:

  • macOS 10.14.3 (18D109)
  • MacBook Pro (15-inch, 2018)
  • 2.6 GHz Intel Core i7
  • 16 GB 2400 MHz DDR4

Rustracer:

  • Took 56.091 seconds.
  • Run using cargo run --release > image.ppm (Time above subtracts 0.79s build time)

Reference:

  • Took 58.051 seconds.
  • Built using g++ -O3 main.cc -o main

Both programs are single threaded.

You can’t perform that action at this time.