Windowsでmitsubaをコンパイルする
動機
法線分布関数(NDF)にGGXなどのモデルではなく計測してきたデータを入れたかったので、windowsにmitsubaのコンパイル環境を作りました。
Visual Studio 2017版
Visual Studio 2017(v15)のインストール
https://docs.microsoft.com/ja-jp/visualstudio/releasenotes/vs2017-relnotes
※後の工程で、Sconsに、Visual Studio 2017(v15)を入れてるのに、Visual Studio 2015(v14)が入っているよと言われてしまうバグ?がある。これが出たらVisual Studio 2010でやるといいと思います。(Visual Studio 2013はインストールでエラーがたくさん出ました)
Python2.7のインストール(パス通す)
https://www.python.org/downloads/windows/
Scons2.5.1のインストール
(v3.1.2でも良さそう )
pip install scons
また、
pip2 install scons
もしくは、
https://sourceforge.net/projects/scons/files/scons/2.5.1/
からscons-2.5.1-setup.exeをダウンロードして起動
Qtのインストール(パス通す)
https://www.qt.io/jp/download_short
Mitsubaのダウンロード
https://github.com/mitsuba-renderer/mitsuba
dependenciesのダウンロード
https://github.com/mitsuba-renderer/dependencies_win64
ファイル操作
mitsuba/build/config-win64-msvc2017.pyをrootにコピー
config.pyに改名
ダウンロードしてきたdependenciesをmitsubaのrootに置く
コマンドプロンプトを開く
> cd mitsuba
> scons
うまくいけば
> scons: done building targets.
と出る
そしてmitsuba/dist/mitsuba.exeが生まれている
試しにコーネルボックスをレンダリング
http://www.mitsuba-renderer.org/download.html
cbox.xmlの
<scene version="0.5.0">
を
<scene version="0.6.0">
に変更する
> mitsuba.exe cbox.xml
でexrファイルができる
[追記]
久しぶりにmitsuba.exeでレンダリングしようとすると以下のエラーが出た。
This application failed to start because it could not to find or load the Qt platform plugin “windows” in””. Reinstalling the application may fix this problem.
こちらの記事を参考に解決をしました。
手順としては、
windows(c)→ ユーザー→ ユーザー名→ AppDate→ Local→ Microsoft→ Onedrive→ Update
Updateを開いてOneDriveSetUp.exeをダブルクリックする
とのことでした。
手順を経た後、コマンドプロンプトを再起動し、
> mitsuba.exe cbox.xml
を実行すると無事レンダリングできました。
Visual Studio 2010版
Visual Studio 2010(v10)のインストール
https://visualstudio.microsoft.com/ja/vs/older-downloads/
Python2.7のインストール(パス通す)
https://www.python.org/downloads/windows/
Sconsのインストール
pip2 install scons
Qtのインストール(パス通す)
https://www.qt.io/jp/download_short
Mitsubaのダウンロード
https://www.mitsuba-renderer.org/download.html
dependenciesのダウンロード
https://www.mitsuba-renderer.org/repos/
ファイル操作
mitsuba/build/config-win64-msvc2010.pyをrootにコピー
config.pyに改名
ダウンロードしてきたdependencies_windowsをdependenciesにRenameしてmitsubaのrootに置く
コマンドプロンプトを開く
> cd mitsuba
> scons
うまくいけば
> scons: done building targets.
と出る
そしてmitsuba/dist/mitsuba.exeが生まれている
試しにコーネルボックスをレンダリング
http://www.mitsuba-renderer.org/download.html
cbox.xmlのシーンバージョンが
<scene version="0.5.0">
であることを確認
> mitsuba.exe cbox.xml
でexrファイルができる