PBRT 2.0

PBRT 2.0

最近PBRT的官网放出这样一段news:

"We're having a contest to render the cover image for the second edition of the pbrt book---the best image rendered with pbrt submitted by December 1 will be featured as the image on the cover of the book. (See the full contest rules for more information.) We are also looking for excellent rendered images to help show off concepts like depth of field, indirect lighting, caustics, subsurface scattering, etc. Contact authors at pbrt dot org if you have an image you'd like to submit for these purposes."

看样子在为PBRT第二版征集封面图片。但在book发布之前,作者老早就把source code放出来了,这次直接从1.04飙升到2.0。网上很多人评价说学习PBRT,首先编译代码的门槛就很高,确实也是这样的。抱着看看2.0在这方面有无改进的想法,下载了source code,这次直接是vs 2008的solution了。但依旧需要bison和flex,无妨,直接使用for windows的版本(在Win7下也能工作)。从1.04开始就不再包含openexr,2.0也不例外,但新版比老版本的代码及二进制部署更为合理,不再极端地为一个类产生一个dll了,而是很干净地生成一个pbrt.exe。要编译openexr(http://www.openexr.com/,最新版为1.6.1),需要ilmbase(http://www.openexr.com/,最新版为1.0.1)和zlib(www.zlib.net,最新版为1.2.3)。在编译zlib时,根据微软如下解释:“It (Microsoft Macro Assembler 8.0, included with Visual C++ 2005 Express ) refuses to assemble a MOVD instruction with a memory operand with an implied size, and requires that "dword ptr" prefix the memory operand.”需要将编译错误指令movd的源地址用dword ptr修饰。随后编译ilmbase和openexr,期间有一些手工调整的地方,很容易搞定。最终openexr的产出放置与..\..\..\..\..\..\Deploy下。然后在pbrt项目中指定include、lib,以及加入PBRT_HAS_OPENEXR和OPENEXR_DLL Preprocessor Definition(代码缺省是tga而非exr作为纹理文件格式和输出图片格式,然而作者提供的scene却使用exr,这显然是个悲剧)。最后,干脆直接用bison和flex将ll和yy产生cpp了,然后把编译时调用bison和flex代码从.vcproj中剔除。
最终用编译产生的pbrt.exe渲染了几幅,只有一幅成功了(简直就是一个悲剧,后面慢慢查找原因)。看来2.0在代码易编译上,仍旧毫无改进。
聊以自慰,贴一张在本子上耗时126.4s的图(CPU: P8700,MEM: DDR3 1066 4G):
PBRT 2.0_第1张图片

你可能感兴趣的:(PBRT 2.0)