I created a Blender 3D model, exported the Blender project as .obj format. While exporting I made sure that I selected include Normals, Keep vertex order. This project contains a sphere which was UV unwrapped with a JPG file.
I got two files, 1) .obj file and .mtl file. I changed them to _mtl and _obj files.
Please find the content of mtl file below
# Blender MTL File: 'Earth.blend'
# Material Count: 1
newmtl earth_test.jpg
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
map_Kd test.jpg
I made sure that there are no spaces in _mtl files. test.jpg file is present in res/drawable folder. I also kept earth_test.jpg file in res/drawable folder.
I loaded the obj file using the following code.
scene.lights().add(new Light());
IParser parser = Parser.createParser(Parser.Type.OBJ,
getResources(), "com.geeks.begining:raw/earth_obj", true);
parser.parse();
objModel = parser.getParsedObject();
objModel.scale().x = objModel.scale().y = objModel.scale().z = .8f;
scene.addChild(objModel);
Still when the app is loaded texture is missing. Only a sphere is displayed. It looked like the image in Blender in Solid view.
Am I still missing something? Please help
I found what is the problem. My Texture image was a bit lesser in size I changed the size and now it worked 🙂