Can Babylon import a standalone material from a GLTF file?
Example file:
{
“asset”: {
“generator”: “COLLADA2GLTF”,
“version”: “2.0”
},
“materials”: [
{
“pbrMetallicRoughness”: {
“baseColorFactor”: [
0.800000011920929,
0.0,
0.0,
1.0
],
“metallicFactor”: 0.0
},
“name”: “Red”
}
]
}
pinging @bghgary
@BrianW No, not currently. Please file a feature request on GitHub if this is something you would like to see added to the loader.
Thanks for the feedback.
Could this feature request include exporting single materials as well? =]
I would make that two separate requests as they are in different repos.
Added Feature Request:
Thank you =)!
I found this thread because I was looking for this too. Is It already possible?
Not yet but it is planned for the near future.
PR is on its way:
Use:
BABYLON.SceneLoader.OnPluginActivatedObservable.add((plugin) => {
plugin.loadAllMaterials = true;
});
to enable the feature.
Hello guys,
thanks for your effort. I really appreciate this community.
I am a little bit confused. The GitHub issue is closed. Are we able to load single standalone materials on demand? If yes, how can I achieve it?
Best
Yes you can, simply add:
BABYLON.SceneLoader.OnPluginActivatedObservable.add((plugin) => {
plugin.loadAllMaterials = true;
});
This will load the materials from your file even if they are not used by any mesh. So a file with only materials can be loaded by using this flag.
Oh, I didn’t expect that’s all. It works like a charm. Thank you!