Heath's Blog

There is no end, it is just the beginning! - A Game Developer's Notes

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):

posted on 2009-11-03 00:54 Heath 阅读(5033) 评论(18)  编辑 收藏 引用 所属分类: Graphics Programming

Feedback

# re: PBRT 2.0 2009-12-20 00:52 slashspirit

请问楼主何处可以找到pbrt2.0源码?我在官网上没有看到链接,是有其他途径么?可以分享一下么?
今晚刚用VS2008编译了1.03 运行时会在WriteRGBAFile那里出异常...
谢谢!  回复  更多评论   

# re: PBRT 2.0[未登录] 2009-12-28 12:28 Heath

@slashspirithttp://github.com/mmp/pbrt-v2  回复  更多评论   

# re: PBRT 2.0 2010-07-11 19:19 pbrt

你好。我在官网下载的pbrt-v2的源码的pbrtlex.ll没有办法编译,不知道怎么回事,出现下面这样的错误:
error PRJ0019: 某个工具从以下位置返回了错误代码: "Flexing core\pbrtlex.ll"
但编译pbrtparse.yy时一点问题都没有。
不知道你编译时有没有遇到这样的问题。  回复  更多评论   

# re: PBRT 2.0[未登录] 2010-07-11 21:34 Heath

@pbrt
注意flex指定输出文件的格式,-o后没有空格,如:
..\bin\flex -ocore\pbrtlex.cpp core\pbrtlex.ll  回复  更多评论   

# re: PBRT 2.0[未登录] 2010-07-11 22:06 Heath

我上传了一份在googlecode上,支持vs2010和vs2008(pbrt.sln.old),有需要的同学自助:
http://code.google.com/p/offline-renderer/downloads/list  回复  更多评论   

# re: PBRT 2.0 2010-07-15 10:23 pbrt

@Heath
嗯,就是-o后面多个空格的问题,现在已经解决了!多谢!没有OpenEXR和ilmbase的编译已经完成了,加入它们两个的还在解决中,要是有问题还要向你请教,呵呵~  回复  更多评论   

# re: PBRT 2.0 2010-07-15 12:21 pbrt

在VS2008下编译正常,在VS2010中会出现很多错误,是为什么呢?
在pbrt项目中指定include、lib,以及加入PBRT_HAS_OPENEXR和OPENEXR_DLL Preprocessor Definition,这些在哪里设置?
呵呵,对VS2008、2010以及pbrt-v2都算是新手,很多不熟悉的。
pbrt-v1时也挺麻烦的,不过到V2之后很多都不知道怎么设置了  回复  更多评论   

# re: PBRT 2.0 2010-07-17 10:08 pbrt

@pbrt
已经搞定了,呵呵,就是渲染时需要的时间变得比v1时长了不少,编译smoke-2.pbrt用了170多秒,bunny.pbrt用了十来分钟,渲染出来的效果也不太好~~  回复  更多评论   

# re: PBRT 2.0 2010-08-04 17:10 fseraph

原来你的blog换地方了,今天才发现  回复  更多评论   

# re: PBRT 2.0 2010-09-10 23:40 CecileChandler

Some time ago, I did need to buy a car for my corporation but I didn't earn enough cash and could not purchase something. Thank God my mother adviced to take the <a href="http://bestfinance-blog.com/topics/home-loans">home loans</a> at creditors. Thus, I did so and used to be satisfied with my short term loan.   回复  更多评论   

# re: PBRT 2.0 2010-11-16 21:39 essay

My practice with progressive custom term paper company has been rewarding. You have fill my own expectations and the customer term paper you offer is extremely accommodating to my needs.Thank You!  回复  更多评论   

# re: PBRT 2.0 2012-07-01 23:10 written essay

Are you looking for good paper writing service? Check our home page (qualityessay.com) and purchase essay writing from the expert agency.  回复  更多评论   

# re: PBRT 2.0 2012-09-27 15:11 new comer

我是新手,编译出了pbrt.exe 用的是vs2010 pbrt2.0版本,可是怎么进行渲染,望指教,详细的,多谢  回复  更多评论   

# re: PBRT 2.0[未登录] 2012-10-11 22:47 Heath

@new comer
PBRT是命令行程序,使用pbrt --help可以看到usage。它以.pbrt文件(场景描述文件)为输入,缺省输出.exr,用imageview打开。另外,pbrt的示例场景可以到它的官网下载。  回复  更多评论   

# re: PBRT 2.0 2012-10-13 18:53 new comer

谢谢,已经可以看到图片了  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理