Why does my OBJ / MTL model material show up as black?

橙三吉。 提交于 2019-12-20 01:58:16

问题


Why does my OBJ model have has no material and display as black?

I have an OBJ:

<a-obj-model  id="gorilla" src="#gorilla-obj" mtl="#gorilla-mtl"></a-obj-model>

I can see the geometry, but the material shows up as black.


回答1:


If you check your MTL, you might notice it is trying to use TGA or some other sort of textures that aren't plain images. In this case, you need to include additional three.js loaders.

You could try including all the necessary loaders like including https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/TGALoader.js and THREE.Loader.Handlers.add( /\.tga$/i, new THREE.TGALoader() );

However, it might be simplest to just batch convert all the TGAs to just use images like PNGs using a converter, and replace all instances of 'tga' with 'png'.



来源:https://stackoverflow.com/questions/40433713/why-does-my-obj-mtl-model-material-show-up-as-black

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!