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

gltf / glb material import issue #526

Open Remi-Tribia opened 5 years ago

Remi-Tribia commented 5 years ago

Hi,

GLB import seems broken, it doesn't take into account the metallicFactor & roughnessFactor (and maybe other properties), converted SFA metallic is always 0 and roughness always 1. The same model exported in glTF instead of glb doesn't have this issue, metallic & roughness are correct in SFA...

ishaang10 commented 5 years ago

you can manually change these roughness and metallic factors from the .sfb model viewer

tinahaibodi commented 5 years ago

what database are you using to import gltf / glb material? or are you doing it locally?

seanadkinson commented 5 years ago

I'm seeing the same issue with FBX as well. If we import fbx or glb models, the metallic and roughness are always 0 and 1. For an fbx, if I use fbx2gltf first and import the model as gltf, I get the sfa created with metallic and roughness filled in correctly.

tpsiaki commented 5 years ago

Thank you for the report. This is a bug where the Sceneform gradle plugin isn't setting the default material properly for glb files.

To work around this, you can modify the sceneform.asset specification in your app build.gradle file to specify the gltf material explicitly, then delete the associated .sfa file and rebuild your project.

For example, if you had an imported glb that looked like this:

sceneform.asset('sampledata/models/model.glb',
        'default',
        'sampledata/models/model.sfa',
        'src/main/res/raw/model')

You would replace the material like this:

sceneform.asset('sampledata/models/model.glb',
        'build/sceneform_sdk/default_materials/gltf_material.sfm',
        'sampledata/models/model.sfa',
        'src/main/res/raw/model')