最近PBRT的官網(wǎng)放出這樣一段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發(fā)布之前,作者老早就把source code放出來了,這次直接從1.04飆升到2.0。網(wǎng)上很多人評價說學(xué)習(xí)PBRT,首先編譯代碼的門檻就很高,確實也是這樣的。抱著看看2.0在這方面有無改進(jìn)的想法,下載了source code,這次直接是vs 2008的solution了。但依舊需要bison和flex,無妨,直接使用for windows的版本(在Win7下也能工作)。從1.04開始就不再包含openexr,2.0也不例外,但新版比老版本的代碼及二進(jìn)制部署更為合理,不再極端地為一個類產(chǎn)生一個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時,根據(jù)微軟如下解釋:“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,期間有一些手工調(diào)整的地方,很容易搞定。最終openexr的產(chǎn)出放置與..\..\..\..\..\..\Deploy下。然后在pbrt項目中指定include、lib,以及加入PBRT_HAS_OPENEXR和OPENEXR_DLL Preprocessor Definition(代碼缺省是tga而非exr作為紋理文件格式和輸出圖片格式,然而作者提供的scene卻使用exr,這顯然是個悲劇)。最后,干脆直接用bison和flex將ll和yy產(chǎn)生cpp了,然后把編譯時調(diào)用bison和flex代碼從.vcproj中剔除。
最終用編譯產(chǎn)生的pbrt.exe渲染了幾幅,只有一幅成功了(簡直就是一個悲劇,后面慢慢查找原因)。看來2.0在代碼易編譯上,仍舊毫無改進(jìn)。
聊以自慰,貼一張在本子上耗時126.4s的圖(CPU: P8700,MEM: DDR3 1066 4G):