[Mitsuba 0.6] 日志

Log

运行

  • 因为是动态链接,需要把库加载目录放到环境变量中
1
2
3
4
5
# mitsuba 可执行文件目录
export PATH="~/data/ears/mitsuba/dist:$PATH"

# 库加载(注意 gcc 不会识别 ~ 目录符号)
export LD_LIBRARY_PATH="/home/xxx/data/ears/mitsuba/dist:$LD_LIBRARY_PATH"

Qt 相关问题

  • 如果不准备使用 gui,可以直接不生成 mtsgui
  • 在下面文件中修改 Qt 相关代码
    • mitsuba/build/SConscript.configure
  • 删除
1
2
3
4
5
6
7
8
9
--- try:
--- env = Environment(options=vars, ENV = os.environ, tools=['default', 'qt5'], toolpath=['#data/scons'])
--- print('Checking for Qt 5.x... yes')
--- hasQt = True
--- except Exception as e:
--- print(e)
--- env = Environment(options=vars, ENV = os.environ, tools=['default'], toolpath=['#data/scons'])
--- print('Unable to detect a Qt installation -- not building the GUI!')
--- hasQt = False
  • 添加
1
2
3
+++ print('Checking for Qt 5.x... ignore')
+++ env = Environment(options=vars, ENV = os.environ, tools=['default'], toolpath=['#data/scons'])
+++ hasQt = False

添加新库

  • 最简单的还是直接放到 /usr/ 目录下,但是不一定有权限
  • 示例仓库:ears

oidn 为例

  • 例如 oidn
  • 文件放在根目录下

  • 添加 include 目录

    • 文件:mitsuba/config.py
      • BASEINCLUDE 添加目录(第二项)
    • #include 路径是 mitsuba/include
    1
    BASEINCLUDE    = ['#include', "#include/../../oidn/include"]
  • 添加静态库目录

    • 直接在环境变量中添加
      • 例如我的路径是:/home/xxx/data/ears/oidn/lib
      • 注意:gcc 不识别 ~ 路径
    1
    export LIBRARY_PATH="$LIBRARY_PATH:/home/xxx/data/ears/oidn/lib"
    • 在使用的地方添加编译选项(源代码中已经添加了
      • 文件:mitsuba/src/integrators/SConscript
    1
    2
    3
    4
    5
    6
    # 编译选项
    oidnEnv = env.Clone()
    oidnEnv.Append(LIBS=['OpenImageDenoise'])

    # mitsuba 添加插件
    plugins += oidnEnv.SharedLibrary('recursive_path', ['path/recursive_path.cpp'])
  • 添加动态库目录

    • 直接在环境变量中添加
    1
    export LD_LIBRARY_PATH="/home/xxx/data/ears/oidn/lib:$LD_LIBRARY_PATH"

VSCode 调试

  • 直接就能调试,配置 launch.json
  • 配置好可执行文件(program)以及命令行参数(args)就可以
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
"version": "0.2.0",
"configurations": [
{
"name": "gdb",
"type": "cppdbg",
"request": "launch",
"program": "/home/xxx/data/ears/mitsuba/dist/mitsuba",
"args": [
"scenes/cbox/cbox.xml"
],
// 调试程序是否在程序入口点处停止
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
]
}

调用链

  • mitsuba/src/mitsuba/mitsuba.cpp
    • mts_main()
      • 核心模块的启动与注册
      • 调用 mitsuba_app()
    • mitsuba_app()
      • 解析 XML 文件
      • 启动 RenderJob
  • mitsuba/src/librender/renderjob.cpp
    • start():继承父类 Thread
    • run()
      • m_scene->preprocess()
      • m_scene->render()
  • mitsuba/src/librender/scene.cpp
    • 清空 film
    • m_integrator->render()
  • mitsuba/src/librender/integrator.cpp
    • SamplingIntegrator:所有的 integrator 的基类
    • render()
      • ref<ParallelProcess> proc = new BlockedRenderProcess(job, queue, scene->getBlockSize());
      • sched->schedule(proc)
        • 调用 BlockedRenderProcessprocess() 函数
          • m_integrator->renderBlock()
          • 进入到具体的 integrator 中
  • mitsuba/src/integrators/path/recursive_path.cpp
    • EARS 工作