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

SFB baseColorTint set to grey instead of original colors #209

Closed itanbp closed 6 years ago

itanbp commented 6 years ago

Hi, I download several models from Google Poly. Many of the objects look grey, instead of the original model colors. For example, this candy corn looks in Android Studio's viewer grey: grey But this is how the original model looks: original

Important to mention that there are models that Sceneform plugin rendered correctly, for example this licorice model. More models that didn't render correctly: cherry and gummy bear

Working with Sceneform plugin version 1.3.0 on Windows.

SFA code:

{
   materials: [
      {
         name: "DefaultMaterial",
         parameters: [
            {
               baseColor: null,
            },
            {
               baseColorTint: [
                  0.59999999999999998,
                  0.59999999999999998,
                  0.59999999999999998,
                  1,
               ],
            },
            {
               metallic: 0,
            },
            {
               roughness: 1,
            },
            {
               opacity: null,
            },
         ],
         source: "build/sceneform_sdk/default_materials/obj_material.sfm",
      },
   ],
   model: {
      attributes: [
         "Position",
         "TexCoord",
         "Orientation",
      ],
      collision: {},
      file: "sampledata/models/249_Candy_Corn.obj",
      name: "249_Candy_Corn",
      scale: 0.099334000000000006,
   },
   version: "0.51:1",
}
gstanlo commented 6 years ago

This looks like a bug. In the top of the obj file, you can see the lines:

g Candy_Corn
mtllib 249_Candy Corn.mtl

As a workaround, transpose those two lines so it reads

mtllib 249_Candy Corn.mtl
g Candy_Corn
itanbp commented 6 years ago

@gstanlo thanks!

dimov96 commented 4 years ago

@gstanlo thank you for this post. I am currently facing the same problem but in my case the .obj file starts with these lines:

mtllib object_ga_25.mtl
o Barrel
v 0.793174 1.064640 -0.168964
...

Has anyone found solution to this problem?