Windows setup
Personally, I built the system on Windows. If you do the same, make sure you have Cygwin installed (along with bison and flex in the Cygwin package) from www.cygwin.com. It is convenient if you install this package to c:\cygwin. Secondly you must have Microsoft Visual Studio 2003 installed (you can get a copy from the SOC lab if you don't have it).
Once your system meets these prerequisites you can install by following these steps:
- Unzip the SOURCE.ZIP file from the WINDOWS directory from the CD-ROM that comes with the book. Personally I unzipped this file into c:\pbrt on my system. Thefiles will unzip into c:\pbrt\src.
- Open the pbrt.sln file from the c:\pbrt\src\win32 directory and build the project (this will take a while, so go get a sandwich or wash your car). When the build is complete (hopefully error free) the pbrt.exe executable and plugin DLLs will be stored inc:\pbrt\src\win32\Projects\Debug.
- Now you must modify your PATH and PBRT_SEARCHPATH environment variables so PBRT knows where to look for plugins etc. To do this edit your .bashrc file (in your Cygwin user directory, note that if you don't have a .bashrc file you can create one from scratch, or worst case, edit the systemwide .bashrc at /etc/bash.bashrc) and add the following lines:
export PBRT_SEARCHPATH=/cygdrive/c/pbrt/src/OpenEXR/bin:/cygdrive/c/pbrt/src/win32/Projects/Debug:$PATH export PATH=$PBRT_SEARCHPATH:$PATH
Note. The .../OpenEXR/... path allows you to access the OpenEXR utilities that allow you to view the .exr files created by PBRT. For more information about this file format visit www.openexr.com.
- You also need to add a PBRT_SEARCHPATH variable to your windows environment. To do this in Windows XP go to:
Start->Control Panel->System->Advanced->Environment Variables
From here add a new user variable called PBRT_SEARCHPATH. I set mine to C:\pbrt\src\win32\Projects\Debug. - Now you can test PBRT by extracting the sample scene files (SCENES.ZIP) from the CD-ROM located in WINDOWS directory. I extracted them to my $HOME/pbrt Cygwin directory. Then from $HOME/pbrt/scenes I ran the command:
sharpr@jaguar ~/pbrt/scenes $ pbrt simple.pbrt
and got the following outputpbrt version 1.000 of Sep 22 2004 at 16:57:33 Copyright (c)1998-2004 Matt Pharr and Greg Humphreys. For educational use only; commercial use expressly forbidden. Rendering: [+++++++++++++++++++++++++++++++++++++++++++++++++] (12.8s) Statistics: Camera Camera Rays Traced 166.5k Geometry Total shapes created 1 Kd-Tree Accelerator Avg. number of primitives in leaf nodes 1:1 (1.00x) Leaf kd-tree nodes made 1 Maximum number of primitives in leaf node 1 Lights Number of shadow rays traced 56.2k Shading Number of points shaded 56.2k
The result was a file called simple.exr which is the OpenEXR format described above. To view this file you can use a utility called exrdisplay.exe located in the /cygdrive/c/pbrt/src/OpenEXR/bin directory. I typed:
sharpr@jaguar ~/pbrt/scenes $ exrdisplay.exe simple.exr &
And ended up getting a window that looked like:
- If for some reason you are unable to link to or execute the OpenEXR binaries or libraries you may need to build them from source. You can do this by following the instructions in Steven Bergner's document in the section entitled "Rebuilding OpenEXR".
http://blog.csdn.net/lqhbupt/article/details/7814520
1)从官方网站下载PBRT软件包:http://www.pbrt.org/downloads.php,选择pbrt-v2-src.zip,for Windows。将压缩包解压到某一目录下,推荐解压到硬盘的根目录,例如C:\pbrt-v2
2)使用Microsoft Visual Studio 2010打开压缩包中的src/pbrt.vs2010/pbrt.sln,选择Debug或Release,以及编译平台x86(win32)或x64。然后Build解决方案。
3)设置系统环境变量PBRT_SEARCHPATH。创建一个系统环境变量PBRT_SEARCHPATH并将它的值设置为PBRTSRC_ROOT/bin目录。例如将PBRT_SEARCHPATH设置为C:\pbrt-v2\bin目录。
至此已经完成了PBRTv2的安装,可以使用该软件包了。
如果用户需要修改PBRT中的parsing代码,还需要安装Bison/Flex程序。用户可以选择Cygwin或者GnuWin32。需要注意的是,不要选择安装在”Program Files”或者“Program Files(x86)”目录下,因为安装路径中不允许存在空格。例如可以选择目录c:\cygwin或者c:\gnuwin32。任意选择一个即可。
a)选择安装GnuWin32http://gnuwin32.sorceforge.net/
安装Bison和Flex软件包。
b)选择安装Cygwinhttp://www.cygwin.com/
安装Cygwin及Bison和Flex软件包,需要注意的是可能默认安装没有选择这两个软件包,用户在安装时应自行选择。
下一步就是将Bison和Flex可执行程序的路径添加到系统环境变量。即目录c:\gnuwin32\bin或者c:\cygwin\bin
假设选择了cygwin,此时需要修改Cygwin下的PATH和PBRT_SEARCHPATH环境变量,这样在Cygwin下运行PBRT时知道去哪儿找到相应的应用程序和DLLs。打开Cygwin用户目录下的/ect/bash.bashrc/systemwide.bashrc文件,如果没有则自行创建该文件,并加入以下两行:
export PBRT_SEARCHPATH=/cygdrive/c/pbrt-v2/bin:$PATH
export PATH=$PBRT_SEARCHPATH:$PATH
由于PBRT生成的图片是OpenEXR格式的高动态范围图片(High Dynamic RangeImage),浏览这些图片也需要相应的图片浏览器。你可以下载安装支持EXR格式的Windows下的图片浏览器IRFANVIEW(http://www.irfanview.com/)。