I know gltf/glb spec only supports PBR materials. What would be the correct way to support standard materials being built and bound instead? We are wanting to export as glb; I know .babylon would support it but that would change a bit of our pipeline and we would like to avoid that!
My first assumption is to attach some sort of metadata to the objects that flags them to use a standard material then in my custom import plugins that we already have worked out just add a new one that builds the correct standard material and disposes the imported PBR one.
Does anyone have some new fangled magic that would work better or is that about the path we need to head down?
Could you create your own glTF material extension? I think by doing so, you can override Babylon’s creation of PBR materials and use your own instead.
My blog post from a while ago talks about this exact scenario. The example is here: https://www.babylonjs-playground.com/#20XT9A#4.
If you need to be able to store specific material properties that are not already available, then creating a custom glTF extension is probably the right thing to do. If you are in a completely closed ecosystem, then using extras might be okay also.
I was able to get the extension to run, but it looks like its dropping an error for me?
It does this on the very first material it is trying to build.
Why in your example does it not drop this error?
I will try to, it might be because we are using SceneLoader and asset containers.