Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

aframe

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.

like image 358
ngokevin Avatar asked Dec 14 '25 02:12

ngokevin


1 Answers

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

like image 121
ngokevin Avatar answered Dec 16 '25 23:12

ngokevin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!