mitsuba基本使用教程
Mitsuba是一个免费开源项目,基于物理渲染器实现了各种材料和体积散射模型,并且集成了一些最新技术(双向路径跟踪,光子映射等等)。Mitsuba可以处理许多实时渲染问题,并且无需花费太多时间去阅读文档来弄清接口和文件格式,且mitsuba具有集成新功能的插件系统,因此我们可以在使用Mitsuba的光线跟踪/采样/集成框架基础上尝试自定义材料模型。
1. 下载安装Mitsuba
我们可以在此网址下载安装最新Mitsuba,因为我的系统是win10 x64,因此使用的版本为

接下来按照流程安装就完事儿。
2. 使用Mitsuba载入简单场景
安装结束之后我们可以使用mitsuba载入一个简单场景

本文使用的所有测试文件集合链接在此。
点击 file -> open打开一个场景xml文件(scene_main.xml):

场景文件详情如图所示:


很容易看出,mitsuba通过在<scene></scene>中添加元素最终解析这些元素生成场景,常用元素有:Shapes、Emitters、Sensors、Integrators、Sample generators、Films、Reconstruction filters等。
2.1 Shapes
Mitsuba中,Shapes标签标记了不同物质过度之间的表面,具体定义格式如下图所示:


2.2 Emitters
Emitters标签用于定义光源,包含

详情请见Mitsuba 0.5.0 Documentation - Mitsuba renderer 8.8章。
2.3 Sensors & Films
Mitsuba中,sensors与films共同作用,以一些可用格式记录辐射测量值,例如设置perspective或orthographic cameras,或者测量给定方向的辐射亮度或某个表面接收的辐照度,films定义了如何存储传导测量值并将其转换为在渲染过程结束时写入磁盘的最终输出文件,Mitsuba附带了一些可以写入高动态范围图像格式和低动态范围图像格式(如OpenEXR,JPEG或PNG)以及更加科学化的数据格式(如MATLAB,Mathematica)。语法如下图所示:

2.4 Integrators
Mitsuba中Integrators用于定义渲染器,包含:

语法如下所示:

2.5 Sample generators
Sample generators用于定义取样器,包含如下取样器:

好了,接下来我们分析场景文件中包含信息。大家下载之前的资源可知,scene_main.xml文件链接了两个xml文件,分别是scene_integrator_cam.xml和scene_objs.xml,我们在scene_integrator_cam.xml设置视角、渲染方法、取样器、保存格式等等,在scene_objs.xml设置场景中的模型,包含光源信息、其他obj模型。

我们修改obj模型中bsdf信息,并保存,点击

重新载入scene_main.xml文件,由于gui的预览用的是opengl实现的vpl,点了渲染按钮才会用xml里面规定的方法渲染,因此我们点击

运行渲染器,也可在下图中

设置渲染器,最终渲染结果如下图所示:

ref:
2. Energy-based Self-Collision Culling for Arbitrary Mesh Deformations