Skip to content

A Rust implementation of the book "Ray Tracing in One Weekend" by Peter Shirley.

License

Notifications You must be signed in to change notification settings

ramonimbao/rt1w

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray Tracing in One Weekend

A Rust implementation of the book Ray Tracing in One Weekend by Peter Shirley.

Some parts of the next book Ray Tracing: The Next Week also implemented.

Samples

Usage

Run the program with cargo run --release. You can also give it a JSON configuration file as an argument to change the render settings without having to recompile the program using --config [config.json]. Scene loading is also now supported using --scene [scene.json]. You can also run the program in single-threaded mode by passing --single-threaded for whatever reason. ¯\_(ツ)_/¯

Example:
$ cargo run --release -- --scene res/scenes/cornell.json --config res/config/cornell.json

Performance

The following are a few stats on renders done on a PC with an i3-2100 CPU. You can see the performance improvement of the multithreading compared to a single thread. I'll add more to this as I do more renders.

Multithreaded Single threaded
Cornell box at 800×600 with 10 SPP 1m 50s 4m 19s
Cornell box at 800×600 with 100 SPP 21m 05s 41m 14s

Here are some stats done on my laptop equipped with an i7-7500U CPU. Seems it's 25% than my old desktop.

Multithreaded Single threaded
Panda Night at 2524×2524 with 25 SPP 9h 31m TBD

To Do

  • Implement being able to input random materials via JSON.
  • Implement --verbose option input to display all messages.

License

This project is licensed under the MIT license - see the LICENSE.md for details.

Image textures obtained from OpenGameArt: "Seamless Space Rocks Textures Pack (512px)" by mafon2.
Licensed under: CC BY 3.0

Crate textures obtained from OpenGameArt: "3 crate textures (w/ bump & normal)" by Luke.RUSTLTD.
Licensed under CC 0 (Public Domain).

Utah Teapot STL file obtained from Thingiverse: "Utah teapot" by phooky.
Licensed under Public Domain.

Stanford Bunny STL file obtained from Thingiverse: "Low Poly Stanford Bunny" by johnny6.
Licensed under CC BY-NC 3.0.

Panda STL file obtained from Thingiverse: "Sleeping Panda - dual color" by jkavalik.
Licensed under CC BY-NC-SA 3.0.

About

A Rust implementation of the book "Ray Tracing in One Weekend" by Peter Shirley.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages