Subclass PBRMaterial or StandardMaterial

Yo @Deltakosh or @sebavan

How do we subclass a PBRMaterial or StandardMaterial and and a few properties to a custom version of the PBR or StandardMaterial shaders.

I use SimpleMaterial type class already… But this implements a very basic diffuse only from scratch… But what if i want to just subclass and PBRMaterial or StandardMaterial and add a texture or float property to material READY and BIND functionality… I dont wanna have to COPY the actual PBRMaterial and change the name to MyCustomMaterial because it would be subclassed from BABYLON.PushMaterial… I want a PBRMaterial or StandardMaterial subclass that i can set the shader name and add custom properties too.

Any ideas what the best way to go about this… That i can put in the toolkit as a Custom Material option… Any help, as always, is very much appreciated :slight_smile:

Hey!
you can find an example here: Babylon.js/pbrMetallicRoughnessMaterial.ts at master · BabylonJS/Babylon.js · GitHub
or there:
Babylon.js/pbrSpecularGlossinessMaterial.ts at master · BabylonJS/Babylon.js · GitHub

Perhaps you can also have a look to Babylon.js/customMaterial.ts at master · BabylonJS/Babylon.js · GitHub as it is hacking the stdMaterial