Skip to content

Ray tracer written in rust based off of the "Ray Tracing in One Weekend" series.

Notifications You must be signed in to change notification settings

drew-y/rustracer

Repository files navigation

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 --example main

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.

About

Ray tracer written in rust based off of the "Ray Tracing in One Weekend" series.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published