gpvigano / AsImpL

Asynchronous Importer and run-time Loader for Unity
MIT License
212 stars 37 forks source link

Materials not loaded #34

Closed KuraiAndras closed 5 years ago

KuraiAndras commented 5 years ago

Problems & bugs

Materials not loaded from .mtl

Environment

  • version of AsImpL commit: bb0156a5bb386d5d7e19e41eede5ee78bb10b887
  • version of Unity3D v2018.3.8

Steps to reproduce

Load temp.obj temp.zip

Expected behavior

Model is loaded with related materials

Current behavior

Model is loaded but with default materials, AsImpL reports that the .mtl file could not be loaded (see picture in the linked .zip folder)

gpvigano commented 5 years ago

Some exporters write OBJ files with absolute path for material library, even if it is in the same directory as the OBJ file.

I added a workaround to load from the same directory as the OBJ file when failed to load from absolute path.

You can find this workaround with this commit.

When the absolute path exists it didn't work because it was appended to the main OBJ path, I also fixed this.

Let me know if this works for you.

KuraiAndras commented 5 years ago

Thanks, it seems to be working. The materials are loaded, and everything seems to works now.

gpvigano commented 5 years ago

Thank you, I close this issue. Feel free to reopen it if you discover further problems.