google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Textures do not show on obj models. #779

Open Jaconici opened 5 years ago

Jaconici commented 5 years ago

I'm having an issue thats driving me mad, I have built a simple app with a sceneview and added a simple model of a rock to the scene and it works, textures load etc. However, I then wanted to move on my using my own obj model which I exported from blender, and the model loads geometrically correctly, but shows only a smooth uniform greyish colour (which actually depends on the textures I'm using so if I use an orangey texture its smooth orange etc). I've checked the mtl files, obj and sfb a hundred times. All file calls point to the correct place and I don't get any error messages, just no texture or bump mapping! Here's the code for all of those mentioned files. mtl:

Blender MTL File: 'Mercury.blend'

Material Count: 1

newmtl Material.001 Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.800000 0.800000 Ks 0.000000 0.000000 0.000000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 1 map_Bump -bm 0.000030 mercury_topo.png map_Ks Mercury_global_map.png map_Kd Mercury_global_map.png map_Ka Mercury_global_map.png

sfb: { materials: [ { name: 'Material.001', parameters: [ { baseColor: 'Mercury_global_map', }, { baseColorTint: [ 0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1, ], }, { metallic: 0, }, { roughness: 1, }, { opacity: null, }, ], source: 'build/sceneform_sdk/default_materials/obj_material.sfm', }, ], model: { attributes: [ 'Position', 'Orientation', ], collision: {}, file: 'sampledata/mercuryobj.obj', name: 'mercuryobj', recenter: 'root', scale: 0.20496, }, samplers: [ { file: 'sampledata\Mercury_global_map.png', name: 'Mercury_global_map', params: { usage_type: 'Data', }, pipeline_name: 'Mercury_global_map.png', }, ], version: '0.54:2', }

I'd add the obj but it's very long, so here's the important lines

Blender v2.79 (sub 0) OBJ File: 'Mercury.blend'

www.blender.org

mtllib mercurymtl.mtl o Mercury_Sphere

usemtl Material.001

2019-07-11

Any ideas how to proceed? Thank you

ivstka95 commented 5 years ago

what about texture coordinates and/or UV? is it correct?

Jaconici commented 5 years ago

what about texture coordinates and/or UV? is it correct?

By texture and UV coordinates do you mean the co ordinates found in the obj files? I haven't edited them and theyre far too long for me to know if they're "correct", not really readable. I've attached the whole obj file in txt format. mercuryobj.txt