Material Management
Efficiently manage multiple materials:
// Clone a material (creates an independent copy)
const material2 = material.clone("material2");
material2.diffuseColor = new BABYLON.Color3(0, 1, 0); // Change color to green
// Share a material across multiple meshes
sphere.material = material;
box.material = material; // Same material instance, changes affect both
// Freeze material to prevent shader recompilation (performance optimization)
material.freeze();