Babylon.js: Load standalone materials from GLTF

Created on 6 Sep 2019  Â·  3Comments  Â·  Source: BabylonJS/Babylon.js

Feature request

Forum Link: https://forum.babylonjs.com/t/standalone-gltf-materials/5481/2

  • Load standalone materials from a gltf file.

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”
}
]
}

enhancement glTF help wanted in progress

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings