Master material for all meshes

I am coming from Unreal and Unity, where in both engines it is possible to change master shader/material on instanced materials.

In Babylon, as I understand, if we want to use custom material, we should create a copy of this master material, and apply to mesh?
But, how to maintain all the original material properties on this new instanced copy?

In Unity and Unreal, when you change master material, it automatically maps out matching features e.g. if both shaders have _diffuseColor or _mainTexture.

In the worst case scenario, I used to create manual mapping, that matches different master material parameters to each-other - is that what I will have to do in Babylon? This will definitely hurt the loading time - unless I figure out how to write this into material files, before loading.

I tried other method first:
I tried exporting mesh from Blender via .glb with a custom material that has required math, but non of it got transferred. Maybe there is a way to create Master material in Blender, and transfer it fully to Babylon? (PBR is not a thing, it is a theoretical concept! Change my mind!)

Thank you.


When you assign a material to the base mesh, all instances will use that same material. You can use instance buffers to change properties: Instances | Babylon.js Documentation ( This also works with our shader creation tool, NME.

1 Like

Yes, use instance buffers or as an alternate method, clone your base, assign cloned material and then disable your base/clone to render only instances. I suppose the method you choose will depend on the number of different materials for your instances. If you have only two or a few different materials and not all that complex meshes, the clone method might be more straight forward and with little impact on performance. Else, use instance buffers.