Hello,
I am new to this topic and have problems with loading textures correctly onto my 3D object.
What I successfully did so far was to load a 3DS model and to put the textures on it via the TextureManager.
But now I have to use a OBJ model. The background is that I did a 3D scan of my face and got the following files:
- oetzi.obj
- oetzi_MATERIAL.mat
- oetzi_TEXTURE-0.jpg
- oetzi_TEXTURE-1.jpg
- oetzi_TEXTURE-2.jpg
The MATERIAL files contains this:
newmtl material_0
map_Kd oetzi_TEXTURE-0.jpg
newmtl material_1
map_Kd oetzi_TEXTURE-1.jpg
newmtl material_2
map_Kd oetzi_TEXTURE-2.jpg
So I changed the Loader.load3DS(...) method to Loader.loadOBJ(InputStream objStream, InputStream mtlStream, float scale).
My first attemp was to set the 2nd paramter to null and to keep the approach to load the texture first into the TextureManager and then use "obj3D.setTexture("material_0")". The result was that my 3D model was displayed but the textures were a total mess.
Then I thought that there might be a reason, why loadOBJ has this second inputStream called mtl :-)
So I tried to load this .mat file as second inputStream
inputStreamMTL = masterContext.getAssets().open("3d-objects/oetzi-obj/oetzi_MATERIAL.mat");
and used it as second paramter for the loadOBJ() method.
Unfortunately, I do not know what I have to do now in order to get the textures onto the 3D model. All I tried so far, did not work.
Therefore, I would be grateful to get a brief explanation, how I have to handle the .obj, the .mat and the texture files to get my final 3D model displayed.
Greetings,
oetzi