为什么我的OBJ / MTL模型材料显示为黑色? [英] Why does my OBJ / MTL model material show up as black?

查看:774
本文介绍了为什么我的OBJ / MTL模型材料显示为黑色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我的OBJ模型没有材质并显示为黑色?

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

我有一个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.

推荐答案

如果检查MTL,您可能会注意到它正在尝试使用TGA或不是普通图像的其他某种纹理。在这种情况下,您需要包括其他three.js加载程序。

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.

您可以尝试包含所有必需的加载程序,例如包括 https:// github .com / mrdoob / three.js / blob / dev / examples / js / loaders / TGALoader.js THREE.Loader.Handlers.add(/\.tga$ / i,新的THREE.TGALoader());

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() );

不过,将所有的TGA批量转换为仅使用图像可能是最简单的例如使用转换器的PNG,并将所有 tga实例替换为 png。

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'.

这篇关于为什么我的OBJ / MTL模型材料显示为黑色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆