glTF overriding materials selectively

I am making a material extention for the glTF loader based on the User Extention part of this article; Extending the glTF Loader in Babylon.js - Babylon.js - Medium

I want to invoke the regular PBR material for some materials and “convert” them to standardmaterial for others. Using just the approach from the article will “convert” all PBR materials. I am set custom properties in Blender to export them as extras in glTF to make the distinction between what materials i want to convert and what I just want to pass to the default PBR material creation.

So the question becomes; How do I invoke the default behaviour from within my extention?

Invoking @bghgary

1 Like

How do I invoke the default behaviour from within my extention?

There are two choices. If you can synchronously determine that the extension is not supposed to do anything at all, you can simply return null. If you need to do some asynchronous work to decide or need to do something before or after the default implementation, then you can invoke the default implementation with loader.loadMaterialPropertiesAsync (or whatever function is being extended) with the same parameters as the extension version.

Thanks bghgary, will try that and get back to you if I cant figure it out :slight_smile:

1 Like