= PBRT Help = Please email cs348b-spr0607-staff@lists.stanford.edu if you are having problems building or running PBRT using your preferred environment. Before emailing, read over the following notes on common issues with getting PBRT up and running on your system. ==== Get pbrt ==== Please grab the pbrt source code (version 1.03) which is available at the following two locations (Please do not use the pbrt code provided on the textbook CD. The downloads below contain many bug fixes from the original release, and we have verified that they run on the Gates B02 {{{myth}}} Linux machines, on VS2003/VS2005, and on MacOS). * http://graphics.stanford.edu/courses/cs348b-07/pbrt/pbrt-cs348b-1.03.zip * /afs/ir/class/cs348b/pbrt/pbrt-cs348b-1.03.tar.gz Unzip the pbrt archive into a local directory. I'll refer to the fully qualified path to the root pbrt directory (your_local_dir/pbrt1.03) as {{{PBRTSRC_ROOT}}}. == Building pbrt on Linux (the 'myth' machines in Gates B08) == ==== Build pbrt and the pbrt tools ==== 1. '''Build pbrt:''' Type "make" from the {{{PBRTSRC_ROOT}}} directory to build pbrt. Binaries will be placed in {{{$(PBRTSRC_ROOT)/bin}}}. 2. '''Build pbrt tools:''' Type "make" from {{{$(PBRTSRC_ROOT)/tools}}} directory to build some utility programs that are useful for working with files that you might include in pbrt scenes. Most notably is {{{exttotiff}}} and {{{tifftoexr}}}, which convert back and forth between the EXR and TIFF image formats. ==== Set up paths ==== 1. pbrt builds each of its subcomponents into separate dynamically linked libaries. At runtime, it uses the environment variable {{{PBRT_SEARCHPATH}}} to find these libraries. Please set {{{PBRT_SEARCHPATH}}} to {{{$(PBRTSRC_ROOT)/bin}}} in your environment. For example, we recommend that you add the following to your {{{.login}}} or {{{.cshrc}}}. {{{ (the following line is for tcsh/csh. Bash users make the appropriate syntax modifications) setenv PBRT_SEARCHPATH $(PBRTSRC_ROOT)/bin (where on your system you'd use the fully qualified path of the root pbrt directory as $(PBRTSRC_ROOT)) }}} 2. You'll also need to add the directory {{{/afs/ir/class/cs348b/ext/lib}}} to your environment's {{{LD_LIBRARY_PATH}}}. If you already have directories in your {{{LD_LIBRARY_PATH}}}, the following lines might be useful to you. {{{ if ($?LD_LIBRARY_PATH == 0) then setenv LD_LIBRARY_PATH endif setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/afs/ir/class/cs348b/ext/lib }}} 2. Lastly it is very convenient to add the directories {{{PBRTSRC_ROOT/bin}}} and {{{PBRTSRC_ROOT/tools}}} to your {{{PATH}}}. 3. To ensure the pbrt is working properly, render a simple test scene, and then convert the EXR output to a TIF file. {{{ pbrt /afs/ir/class/cs348b/pbrt/scenes/checkerboard.prt exrtotiff pbrt.exr pbrt.tif }}} You should now be able to view the image {{{pbrt.tif}}} using any image viewer. ==== A note for installing on other Linux machines ==== Pbrt assumes OpenEXR libraries and headers are installed on your system. You will need to download and install OpenEXR 1.4.0 on your machine before attempting to compile pbrt. OpenEXR downloads are available at http://www.openexr.com. The cs348b pbrt 1.03 makefiles are set up to be used on the {{{myth}}} machines. You use the code on your own Linux machines, you will need to set the pbrt makefiles ({{{PBRTSRC_ROOT/Makefile}}} and {{{PBRTSRC_ROOT/tools/Makefile}}}) to point to the appropriate OpenEXR lib and include directories. Specifically, you'll need to change the values of {{{EXRINCLUDEDIR}}} and {{{EXRLIBDIR}}} to match your system setup. == Building pbrt on Windows Using Visual Studio 2003 == The build of pbrt using Visual Studio 2003 is pretty much straight out of the box. 3. To build pbrt, you will need a minimal installation of [http://www.cygwin.com cygwin] (for flex and bison). Note that if you install cygwin into the default {{{c:\cygwin}}} directory, no modifications to the Visual Studio build are necessary. If cygwin is not installed into this directory, you will need to do change the ''custom build step'' for the files {pbrtlex.l} and {pbrtparse.y} in 'core' project. In VS, right click on these files to bring up the property page, and change the command line for the custom build step to correctly call the cygwin flex and bison executables on your system. 4. Build the entire pbrt solution. A Debug mode build will place binaries in {{{PBRTSRC_ROOT/win32/Projects/Debug}}}. A Release mode build will place binaries in {{{PBRTSRC_ROOT/win32/Projects/Release}}}. 5. Set the {{{PBRT_SEARCHPATH}}}. Pbrt compiles each of its modules as dynamically linked libraries and uses {{{PBRT_SEARCHPATH}}} to find these libraries when running. Create a system environment variable called {{{PBRT_SEARCHPATH}}} and set its value to either {{{PBRTSRC_ROOT/win32/Projects/Debug}}} or {{{PBRTSRC_ROOT/win32/Projects/Release}}}, depending on whether you are working with a debug or release build. You may also find it convenient to add one of these directories to your system path. ==== Building Exrtotiff on Windows ==== {{{Exrtotiff}}} is a simple utility provided with pbrt to convert high dynamic range (HDR) image files (.EXR) produced by a pbrt render into tiff files (.TIF) that can be displayed by most image programs. {{{exrtotiff}}} src is located in the {{{PBRTSRC_ROOT/tools}}} directory. The pbrt archive does not include a Visual Studio project file to build {{{exrtotiff}}} on Windows. We will attempt to provide one shortly. For now, you can download a compiled Win32 binary '''[http://foobar here]'''. == Building pbrt on Windows Using Visual Studio 2005 == == Viewing and converting EXR Images == To view .EXR images produces by pbrt, you can either convert them to .TIF files using {{{exrtotiff}}} or view them directly using an imaging program that supports them. The most common usage of {{{exrtotiff}}} is simply converting from an {{{.exr}}} file to a {{{.tif}}}. {{{ exrtotiff srcfilename.exr outputfilename.tif }}} === Other Programs that can display EXR images === * The latest versions of Photoshop (beginning with CS) can open EXR files directly. * OpenEXR software provides an exr-photoshop plugin for both Windows and OS X. You may download the package from http://www.openexr.com/downloads.html. The documentation is at http://www.openexr.com/photoshop_plugin.html. * To view high-dynamic range (exr) images on Windows, download the OpenEXR Windows binaries from http://savannah.nongnu.org/download/openexr/OpenEXR-1.2.2-win32.zip. The program {{{exrdisplay}}} in this package is a simple exr viewer.