Rendering using PBRT (Version4)

Ujjayanta Bhaumik
4 min readNov 17, 2022

In this article, I would tell you how to render images using PBRT(version 4).

For this tutorial, you would need:

  1. Git installed
  2. Cmake
  3. Visual Studio (I am using the 2019 Community edition)
  4. Blender (to create scenes)
  5. Blender to PBRT exporter

To install PBRT v4, you can follow this video by @steffensensa

There is also a very detailed article from Kunihiko Kaneko Laboratory: Install Physically Based Rendering (using mmp/pbrt-v4 from GitHub, on Windows)

Installing the plugin

  1. Go to https://github.com/stig-atle/io_scene_pbrt
  2. Clone or download the repository

3. Open Blender, go to Edit, and then Preferences

4. In the Blender Preferences window, go to the Add-ons tab and click install.

5. Then locate the folder where you downloaded the repo in Step1. (For me, it was the downloads folder). Click install Add-on.

6. If the Add-on is installed successfully, you should get a message like this:

Exporting scenes from Blender

Blender is one of the best options for creating scenes you want to render. Unless the scenes are straightforward, like a point light lighting a sphere resting on a plane, I do not want you to write scene files by hand and have nightmares. A scene in PBRT would look like this:

Of course, creating such a scene without Blender can give you nightmares. That is why the exporter is super helpful. You create the scene visually in Blender and the plugin does the hard work of creating a scene description file in pbrt format. Now, let’s actually try to render something!!

This plugin works with Blender versions 2.8x. My version is below:

Blender version 2.83.20 (https://www.blender.org/)

I would just use one of the sample scenes in this repository. The samplescene.blend looks like this:

Sample scene in Blender

Let’s export the scene from Blender as output_version3.pbrt

To export the scene, go to the Render Properties tab. Select the Render Engine as PBRT_Renderer.

You can see the PBRT Render settings tab now. Expand that tab by clicking the play button on the left

You can set options like:

  1. Number of samples (default: 1024)
  2. Set the output path where you want the PBRT scene. (Say it’s Downloads folder and you want to save it as output_version3.pbrt. Then you set the output path as C:\Users\Downloads)
  3. Image resolution, and so on…

Set the options, as you prefer.

The destination folder containing the exported scene should look like this:

After exporting the scene, you need to upgrade the scene to pbrt v4. Open cmd and use this command:

pbrt --upgrade output_version3.pbrt > output_version4.pbrt

Now, comes the fun part: rendering. To render, type:

"pbrt.exe" --outfile D:\images\filename.png output_version4.pbrt

You will be able to find the rendered image in D:\images\ (change the path to wherever you want to save your images)

[I got some errors. You might not get them.

Error1: output_version4.pbrt:12:4: “samplepixelcenter”: unused parameter.

To fix this, I opened output_version4.pbrt in Notepad and deleted the line:

“bool samplepixelcenter” [ false ]

]

N.b. You need to add pbrt to the path (add the path pointing to pbrt.exe to environment variables. link)

And finally, the moment you probably were waiting for:

My rendered image looks like this:

Happy rendering!!!

More about PBRT

If you want to read more about PBRT v4, do refer to the official book: https://pbr-book.org/3ed-2018/contents

References:

  1. PBRT exporter

2. PBRT Version 4 (https://github.com/mmp/pbrt-v4)

3. io_scene_pbrt (https://github.com/stig-atle/io_scene_pbrt)

4. Compile pbrt windows (https://www.youtube.com/watch?v=Bx6YKGteEB8)

5. Pbrt book (https://pbr-book.org/3ed-2018/contents)

--

--

Ujjayanta Bhaumik

MSc Computer Vision, Graphics and Imaging, University College London