Getting Started

Get 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:

  1. GitHub repository
  2. Codeberg repository

Both should be exactly the same, but reported issues etc. might differ.


# using SSH
git clone
# or using HTTPS
git clone


# using SSH
git clone
# or using HTTPS
git clone

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]

    -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 ...
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:

Rendered image of the Cornell Box.

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:

Using more pixel samples.

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
# or using HTTPS
git clone

That's it, for a quick start ... have fun rendering some of the provided scenes!

The Volkswagen Van scene from the GitLab repo.