Here’s a little PG that demonstrates using a custom attribute with instances (this is more a proof of concept than anything else):
Instances are using the new thin instance support (Use Thin Instances - Babylon.js Documentation) and the custom attribute is used to vary the metallic and roughness properties of the sphere.
A node material is used as the basis material, and a custom
NodeMaterialBlock class is created to handle the custom attribute and inject the metallic/roughness values in the workflow. Doing this way instead of creating a
PBRCustomMaterial, for eg, is more future proof as no custom shader code is written, only a custom
NodeMaterialBlock which is guaranteed to work in future versions.
I think writing such custom
NodeMaterialBlock classes could be made easier with some helpers, however. Maybe something that could/will happen in the future!