Getting Started
2018-11-16Get Rust
First install Rust. To keep it up to date use rustup:
rustup update
Compiling rs_pbrt
Cloning the repository
There are two repositories you can get the Rust source code from:
Both should be exactly the same, but reported issues etc. might differ.
GitHub
# using SSH git clone git@github.com:wahn/rs_pbrt.git # or using HTTPS git clone https://github.com/wahn/rs_pbrt.git
TeaHub
# using SSH git clone teahub@teahub.io:wahn/rs_pbrt.git # or using HTTPS git clone https://teahub.io/wahn/rs_pbrt.git
Use Cargo to compile executables
# enter repository cd rs_pbrt # compile without OpenEXR support cargo test --release --no-default-features
For a debug version compile without the --release option.
# compile without OpenEXR support cargo test --no-default-features
For more information about Cargo, check out its documentation.
The executables can be found in either the release or the debug target examples directory:
# release ls ./target/release/examples # debug ls ./target/debug/examples
Create a local copy of the documentation
# no OpenEXR support cargo doc --no-default-features
Use your favourite web browser to open the local (Rust source code) documentation:
firefox target/doc/pbrt/index.html
You can also find the official documentation (of the latest release) on this web site.
Running the renderer
Without arguments (or by providing the -h or --help option) you
get a simple usage message of the main executable rs_pbrt:
# relative path to executable rs_pbrt (assuming release build) ./target/release/examples/rs_pbrt --help # output Usage: ./target/release/examples/rs_pbrt [options] Options: -h, --help print this help menu -i FILE parse an input file -t, --nthreads NUM use specified number of threads for rendering -v, --version print version number
The version can be checked by:
# print version number ./target/release/examples/rs_pbrt --version # output ./target/release/examples/rs_pbrt 0.4.4
Your first rendered image
By specifing an input file (in this case cornell_box.pbrt found in
the repository) via the -i option you can render a
PNG image
(currently always being called pbrt.png):
# specifing an input file ./target/release/examples/rs_pbrt -i assets/scenes/cornell_box.pbrt # output pbrt version 0.4.4 [Detected 8 cores] Copyright (c)2016-2018 Jan Douglas Bert Walter. Rust code based on C++ code by Matt Pharr, Greg Humphreys, and Wenzel Jakob. Film "image" "integer xresolution" [500] "integer yresolution" [500] Sampler "sobol" "integer pixelsamples" [8] Integrator "path" BVHAccel::recursive_build(..., 36, ...) PT0.000589007S seconds for building BVH ... BVHAccel::flatten_bvh_tree(...) PT0.000004423S seconds for flattening BVH ... Rendering with 8 thread(s) ... 1024 / 1024 [==========================================================================================================] 100.00 % 242.25/s Writing image "pbrt.png" with bounds Bounds2 { p_min: Point2 { x: 0, y: 0 }, p_max: Point2 { x: 500, y: 500 } }
The resulting image should look like this:
![]()
If you modify the proper line in cornell_box.pbrt to use more
pixel samples you should end up with a less noisy image, but
rendering will take longer:
![]()
diff --git a/assets/scenes/cornell_box.pbrt b/assets/scenes/cornell_box.pbrt index aa3a210..559e860 100644 --- a/assets/scenes/cornell_box.pbrt +++ b/assets/scenes/cornell_box.pbrt @@ -10,7 +10,7 @@ Film "image" "integer yresolution" [ 500 ] ## "integer outlierrejection_k" [ 10 ] ##Sampler "sobol" -Sampler "sobol" "integer pixelsamples" [8] +Sampler "sobol" "integer pixelsamples" [256] ##PixelFilter "blackmanharris" ##SurfaceIntegrator "bidirectional" ##Integrator "directlighting" "integer maxdepth" [10]
More scenes to render
Because rs_pbrt isn't 100% compatible to the C++ counter part (yet)
I collect .pbrt scene
files in a
separate repository on GitLab. Have a look at the
Wiki
there.
Just clone it to another location:
cd assets/scenes # using SSH git clone git@gitlab.com:jdb-walter/rs-pbrt-test-scenes.git # or using HTTPS git clone https://gitlab.com/jdb-walter/rs-pbrt-test-scenes.git
That's it, for a quick start ... have fun rendering some of the provided scenes!
