Babylon.js: GLB loaded incorrectly

Created on 15 Nov 2017  路  7Comments  路  Source: BabylonJS/Babylon.js

The model included in the playground below loads with transparent faces even though the model is supposed to be fully opaque. The same model loads correctly in the this GLTF Viewer I've tested on OSX on Chrome and Firefox.

http://www.babylonjs-playground.com/#6MZV8R#60

screen shot 2017-11-15 at 12 17 00 pm

bug loaders

Most helpful comment

@FreakTheMighty , you can see a sample here: https://www.babylonjs-playground.com/#6MZV8R#64

All 7 comments

Ping @bghgary

Actually, parsing the glb leads to this json for materials:
"materials": [
{
"alphaMode": "BLEND",
"name": "Naranaja ",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.866666734218597,
0.666666686534882,
0.133333340287209,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Gris 01",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.572549045085907,
0.572549045085907,
0.572549045085907,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Vidrio",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.901960849761963,
0.90588241815567,
0.913725554943085,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"emissiveFactor": [
1,
1,
1
],
"name": "Light",
"pbrMetallicRoughness": {
"baseColorFactor": [
0,
0,
0,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Gris_oscuro con rallas",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.223529428243637,
0.223529428243637,
0.223529428243637,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Naranaja ",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.866666734218597,
0.666666686534882,
0.133333340287209,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Black_1",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.0784313753247261,
0.0784313753247261,
0.0784313753247261,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Rojo_1",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.647058844566345,
0,
0.0745098069310188,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
},
{
"alphaMode": "BLEND",
"name": "Grey",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.572549045085907,
0.572549045085907,
0.572549045085907,
1
],
"metallicFactor": 0.100000001490116,
"roughnessFactor": 0.400000005960464
}
}
]

As you can see all the materials are flagged as "BLEND" which explains the behavior.

You can then force all materials to turn blending off by setting material.transparencyMode = BABYLON.PBRMATERIAL_OPAQUE

@FreakTheMighty , you can see a sample here: https://www.babylonjs-playground.com/#6MZV8R#64

This was definitely FBX2glTF's fault, and it was fixed just the other day. The model will output as OPAQUE now.

I am curious, though; shouldn't the 1.0 alpha in baseColor (absent either diffuse texture or vertex colour) essentially make BLEND meaningless?

I guess this could be animated and having it flagged as blend would prevent switching render queues or shader during the animation but this is a bit of an edge case I agree.

Maybe this could be flagged in the gltf-validator?

@zellski shouldn't the 1.0 alpha in baseColor (absent either diffuse texture or vertex colour) essentially make BLEND meaningless?

Blend in BabylonJS does not write depth, so sorting is an issue. I suppose we can force it back to opaque if alpha is 1.0 in the loader, but the asset is still inherently incorrect.

@sebavan Maybe this could be flagged in the gltf-validator?

@lexaknyazev Is this easy to add to the validator?

Was this page helpful?
0 / 5 - 0 ratings