Skip to content

Implementation of Ray Tracing in One Weekend in Rust

Notifications You must be signed in to change notification settings

Davvos11/raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raytracer

Usage

cargo run --release -- scenes/weekend-final.json # Or another json scene
cargo run --release -- scenes/dragon_recon/dragon_vrip_res4.ply --format ply # Or another ply scene

This will load a scene from a file and render it to the output folder.

cargo run --release -- 

This will generate a new scene based on the code in main.rs (e.g. let (world, filename) = scenes::simple_fuzzy_metal();)
It will write the scene as json to the scenes folder. (and also render to the output folder)

There are various possible options, most importantly, the algorithm for acceleration can be specified using --algorithm <ALGORITHM>. Possible values are naive, bvh or grid.

More options can be added using the -o <OPTION> flag.

For example -o draw-boxes draws the BVH bounding boxes.

Furthermore, --grid-size n can be used to specify the grid size for the grid algorithm.

cargo run --release -- --help # For a list of all options

Tests

cargo test --release

This will run a set of scenes from the scenes folder with different algorithms and options.
The simple scenes will be ran using the naive and BVH algorithms, more complex scenes will not be run using the naive algorithm. For the BVH algorithm three different SAH settings will be tested.

Any time a image is generated using any of the above commands, statistics are collected to output/stats.csv.

Features / implementation details

Acknowledgments

This repository includes some ply models from the Stanford Models. Specifically:

  • Dragon:
    • Source: Stanford University Computer Graphics Laboratory
    • Scanner: Cyberware 3030 MS + spacetime analysis

Final image

About

Implementation of Ray Tracing in One Weekend in Rust

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages