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

mtl-file loading error #953

Open vberezkin opened 4 years ago

vberezkin commented 4 years ago

I try to load material settings from mtl file and got error:

Validating Materials: Validating material: Jsonnet Error: [1]: STATIC ERROR: proc.mtl:1:106: unexpected: ";" while parsing terminal

gradle file (part):

sceneform.asset('sampledata/models/proc.fbx',
        'sampledata/models/proc.mtl',
        'sampledata/models/proc.sfa',
        'src/main/res/raw/proc',
        [])

proc.mtl file:

# WaveFront *.mtl file (generated by CINEMA 4D)

newmtl Gray
Ka 1 1 1
Kd 0.21568627655506 0.21568627655506 0.21568627655506
Ks 1 1 1
Ns 50
illum 7

newmtl White
Ka 1 1 1
Kd 0.93999999761581 0.93999999761581 0.93999999761581
Ks 1 1 1
Ns 50
illum 7

newmtl Fiolet
Ka 1 1 1
Kd 0.96470588445663 0.14509804546833 0.96470588445663
Ks 1 1 1
Ns 50
illum 7

newmtl GraySmall
Ka 1 1 1
Kd 0.61000001430511 0.61000001430511 0.61000001430511
Ks 1 1 1
Ns 50
illum 7

newmtl Yellow
Ka 1 1 1
Kd 0.94901961088181 0.94901961088181 0.09803921729326
Ks 1 1 1
Ns 50
illum 7

newmtl Siren
Ka 1 1 1
Kd 0.76470589637756 0.64705884456635 0.79607844352722
Ks 1 1 1
Ns 50
illum 7

newmtl Orange
Ka 1 1 1
Kd 0.94901961088181 0.49411764740944 0.16470588743687
Ks 1 1 1
Ns 50
illum 7

newmtl Material.004
Kd 0.56981301307678 0.45056185126305 0.38223814964294
HAND_C.jpg
Ks 0.22549019753933 0.21093648672104 0.15549458563328
HAND_S.jpg
Ns 12.345
illum 7

newmtl Mat
Ka 1 1 1
Kd 0.64705884456635 0.4745098054409 0.40784314274788
Ks 1 1 1
Ns 50
illum 7

newmtl Blood
Ka 1 1 1
Kd 0.37000000476837 0 0
Ks 1 1 1
Ns 50
illum 7
SarvagyaVaish commented 4 years ago

I had a similar error. Digging into the .obj file, i found that it was not referring to the .mtl by the correct name. After editing the following line in the .mtl file, the error went away:

mtllib <filenamename>.mtl