= PBRT Help = Please email cs348b-spr0506-staff@lists.stanford.edu if you are having problems building or running PBRT using your preferred environment. You might also check the ["Homework1Discussion"] page where everyone is encouraged to post problems and solutions encountered running pbrt on various environments. The following instructions might help you out though (big thanks to Lee Hendrickson for taking good notes as he went through the trouble). == Building pbrt on Linux (the 'myth' machines in Sweet Hall) == The public release of pbrt 1.02 available on [http://www.pbrt.org www.pbrt.org] requires modification to build on Stanford's 'myth' machines. We have placed a myth-specific tar file online at {{{/afs/ir/class/cs348b/pbrt/pbrt1.02.cs348b.tar.gz}}}. This archive contains two subdirectories: * {{{/pbrt}}} - which contains the PBRT 1.02 source tree with modifications made to its makefiles * {{{/cs348b_extras}}} - which contains a build of OpenEXR and libtiff that are required to properly build PBRT on myth. After unzipping this archive to {{{%%MY_LOCAL_DIR%%}}} in your home directory, you will need to add the following directories to your environment's library search path. * {{{%%FULL_PATH_TO_MY_LOCAL_DIR%%/pbrt/bin}}} * {{{%%FULL_PATH_TO_MY_LOCAL_DIR%%/cs348b_extras/lib}}} For example, assume I unzipped the archive to {{{/afs/ir/users/k/a/kayvonf/src}}}. Then in csh I'd set my LD_LIBRARY_PATH to: {{{setenv LD_LIBRARY_PATH /afs/ir/users/k/a/kayvonf/src/pbrt/bin:/afs/ir/users/k/a/kayvonf/src/cs348b_extras/lib}}} So the entire process to compile PBRT on a myth machine is: 1. extract {{{/afs/ir/class/cs348b/pbrt/pbrt1.02.cs348b.tar.gz}}} into your local AFS space. 2. set the appropriate LD_LIBRARY_PATH (probably a good idea to add this to your .login) 3. build pbrt by typing 'make' from the /pbrt directory 4. build the tools by typing 'make' from the /pbrt/tools directory 5. Before running pbrt, you will need to add {{{PBRT_SEARCHPATH=%%FULL_PATH_TO_MY_LOCAL_DIR%%/pbrt/bin}}} to your environment. == Building pbrt on Windows Using Visual Studio 2003 == The build of pbrt using Visual Studio 2003 is pretty much straight out of the box, and following the instructions in the pbrt book should get you all the way there. A couple notes: * You will need a mimimal installation of [http://www.cygwin.com cygwin] (for flex and bison) to properly build pbrt. 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 the 'parser files' directory of the 'core' project. Right click on these files to bring up the property page, and change the commandline for the custom build step to correctly call the cygwin flex and bison executables on your system. * A complete Visual Studio solution file to build pbrt is located in the {{{/win32}}} sudirectory of the distribution. After a successful build, pbrt binaries and plugins are located in the {{{/win32/Projects/Debug}}} or {{{win32/Projects/Release}}} directories (depending on which build you chose to perform). To run pbrt, you will need to set the environment variable {{{PBRT_SEARCHPATH}}} to one of these directories. * pbrt includes no Visual Studio projects to build {{{exrtotiff}}} on Windows. I'm working on Visual Studio project file to build {{{exrtotiff}}}. It should be available shortly. * 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 for Windows. * If you have Photoshop, the 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. == Building pbrt on Windows Using Visual Studio 2005 == Due to popular demand, here are fairly explicit [http://www.stanford.edu/~lthendri/pbrt/pbrtWindowsInstructions.txt instructions] for building pbrt under Visual Studio 2005. However, for those that don't want to build the whole system themselves, [http://www.stanford.edu/~lthendri/pbrt/pbrt.zip here] are the pbrt binaries built in VS 2005. Two notes for that package: 1. You can use the pbrt binaries as is (in the pbrt/bin, and pbrt/win32/Projects/[Debug, Release] directories), but if you want to recompile (which I'm going to assume we'll need to for later homeworks), use the provided solution file in pbrt/win32/pbrt.sln. (If you already have a pbrt source tree, just replace the win32 directory with this one.) To do this you '''will''' have to also grab some of the support libraries below (namely, OpenEXR). 2. The default solution file doesn't build the tools directory (as in Linux). I've provided a solution file just for exrtotiff (since it seems to be the most useful tool), or you can just use the binaries in pbrt/bin. I would strongly recommend the latter, building it yourself is a royal pain. Support Libraries: 1. [http://www.stanford.edu/~lthendri/pbrt/OpenEXR.zip OpenEXR] - you'll need this if you want to recompile pbrt. To set up the necessary build environment, see the instructions above. 2. [http://www.stanford.edu/~lthendri/pbrt/zlib.zip zlib] - only if you want to also recompile OpenEXR. 3. [http://www.stanford.edu/~lthendri/pbrt/fltk.zip fltk] - only if you want to also recompile OpenEXR's exrdisplay utility. 4. [http://www.stanford.edu/~lthendri/pbrt/libjpeg.zip libjpeg] - only if you want to recompile exrtotiff (though you'll need the bin/jpeg62.dll file to actually run the utility). 5. [http://www.stanford.edu/~lthendri/pbrt/libtiff.zip libtiff] - again, only if you want to recompile exrtotiff (though you'll need the bin/libtiff3.dll file to actually run the utility). If you run into any problem, you can let [http://graphics.stanford.edu/cs348b-06/LeeHendrickson me] know, though I can't promise any particular level of support. == Building pbrt on Gentoo Linux (and possibly other distros) == Installing PBRT: 1. emerge openexr and tar -xzvf pbrt -C $PATH_TO_PBRT_SRC 2. edit Makefile, changing to: * line 6: EXRINCLUDE=/usr/include/OpenEXR * line 36: EXRLIBDIR=/usr/lib 3. edit core/pbrtlex.l, changing to: * line 82-83: WHITESPACE [ \t\r]+ * [this is due to the ^M not being parsed correctly by lex] 4. edit tools/Makefile, changing to: * line 7: EXRDIR=/usr/include/OpenEXR * line 9: CXXFLAGS = $(OPT) -I/sw/include -I$(EXRDIR) -I$(PBRTDIR)/core * line 16: LDFLAGS=-L/usr/lib 5. make 6. cd tools && make Setting Environment Variables: 1. edit ~/.bashrc or similar, adding: * PATH=$PATH_TO_PBRT_SRC/bin/:$PATH * export PBRT_SEARCHPATH=$PATH_TO_PBRT_SRC/bin 2. source ~/.bashrc Good to go! Just type pbrt $FILE to run the program.