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が生まれている

 

試しにコーネルボックスレンダリング

コーネルボックスのシーンファイルxmlをダウンロードする

http://www.mitsuba-renderer.org/download.html

cbox.xml

<scene version="0.5.0">

<scene version="0.6.0">

に変更する

> mitsuba.exe cbox.xml

でexrファイルができる

f:id:Dogy:20191211161901p:plain

[追記]

久しぶりに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.

 

こちらの記事を参考に解決をしました。

https://answers.microsoft.com/ja-jp/windows/forum/windows_10-files-winpc/%E3%83%91%E3%82%BD%E3%82%B3%E3%83%B3%E7%AB%8B/18047d64-e3db-4c68-8e2a-ad1a7ff9c2aa

手順としては、

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が生まれている

試しにコーネルボックスレンダリング

コーネルボックスのシーンファイルxmlをダウンロードする

http://www.mitsuba-renderer.org/download.html

cbox.xmlのシーンバージョンが

<scene version="0.5.0">

であることを確認

 

> mitsuba.exe cbox.xml

でexrファイルができる

f:id:Dogy:20191211161901p:plain