mitsuba-renderer / mitsuba

Mitsuba renderer main repository
GNU General Public License v3.0
1.05k stars 321 forks source link

Is there any way to load an .MTL along with .OBJ file #134

Closed woolpeeker closed 4 years ago

woolpeeker commented 4 years ago

I'm using mitsuba2. It's easy to load a obj file to scene by inserting a obj in the .xml file But the obj file I'm using has a mtl file. I don't find any informatin about how to load a mtl I search the code, and I find the src/shapes/obj.cpp has some code about materials.

https://github.com/mitsuba-renderer/mitsuba/blob/1fd0f671dfcb77f813c0d6a36f2aa4e480b5ca8e/src/shapes/obj.cpp#L220 https://github.com/mitsuba-renderer/mitsuba/blob/1fd0f671dfcb77f813c0d6a36f2aa4e480b5ca8e/src/shapes/obj.cpp#L345

So I add a property in xml like below:

<shape type="obj">
        <string name="filename" value="model.obj" />
        <boolean name="loadMaterials" value="true"/>
</shape>

error occurs: RuntimeError: ​[xml.cpp:1040] Error while loading "scene.xml" (near line 5, col 6): unreferenced property ["loadMaterials"] in shape plugin of type "obj".

So I want to know is it possible to load a mtl directly. Thanks in advance.