My materials aren’t being correctly applied to my .obj model and I’m not entirely sure why. I load the texture, traverse the object and apply the texture to the children (meshes) but it doesn’t seem to properly apply them at all.
BTW: When using MTLLoader with OBJLoader like in webgl_loader_obj_mtl, there is no need to manually load textures and create materials. So please refactor your code and use both loaders.
The MTL file looks weird because its been auto-generated by my own program that converts models from a specific game to Wavefront compatible files, including the .mtl’s. I repacked everything and now the folder structure looks like this;
It still is white which is strange because if I upload the .mtl, the .obj and just the berd_diff_006_a_uni.png to one of the 3d viewer websites it loads the albedo texture perfectly fine. So there’s definitely some property not getting set which I don’t know about.
“It still is white which is strange because if I upload the .mtl, the .obj and just the berd_diff_006_a_uni.png to one of the 3d viewer websites it loads the albedo texture perfectly fine. So there’s definitely some property not getting set which I don’t know about.”
Btw, just based on this I don’t even think I need the spec & normal png files?
If you have the maps, use them. The result will look better.
BTW: Specular maps in three.js are supposed to be grayscale maps. You can use a color map but it the final result might look a bit different compared to other rendering software (because only the red channel is used).
Why do you have to set preserveDrawingBuffer and alpha to true? In most cases, users don’t have to touch these configuration parameters. Especially preserveDrawingBuffer should only be used in just a few use cases.
I assume you mean manually loading the png texture and applying it to the mesh, unfortunately setting format to THREE.RGBFormat doesn’t seem to work with alpha set to true
texture = new THREE.TextureLoader().load("path/to/texture/png");
texture.format = THREE.RGBFormat;
Together with converting the PNG to JPG and the alpha set to true, it does appear now which is a start I guess but the texture is white now;
It also looks like the right part of the face is darker than the left which is strange. I also tried converting the normal maps and the spec ones to JPG too but that didn’t work. By the way I really appreciate you trying to help me sort this out