Forum Link: https://forum.babylonjs.com/t/standalone-gltf-materials/5481/2
Example GLTF file:
{
“asset”: {
“generator”: “COLLADA2GLTF”,
“version”: “2.0”
},
“materials”: [
{
“pbrMetallicRoughness”: {
“baseColorFactor”: [
0.800000011920929,
0.0,
0.0,
1.0
],
“metallicFactor”: 0.0
},
“name”: “Red”
}
]
}
FYI: According to the GLTF spec, a GLTF file may contain collections of materials or other items.
I have suggested that a "material" tag be added to the root scene structure, analogous to the "scene" value that specifies which scene is the "main" one:
https://github.com/KhronosGroup/glTF/issues/1420
Should we add a flag in the GLTF loader to force loading materials that are not used by meshes or should the loader always load all materials from the GLTF file unconditionally?
So we decided with @sebavan to load materials only if a given flag is true and we will only create an instance of a material if not already used by a mesh of the GLTF file.
Most helpful comment
So we decided with @sebavan to load materials only if a given flag is true and we will only create an instance of a material if not already used by a mesh of the GLTF file.