I’m using the .babylon format to serialize mesh[es] because it supports instances - and indeed, I can save and re-import a mesh with its instances. But, the saved mesh file does not include materials, and ImportMesh prints a console warning that it can’t assign a material to the loaded mesh. The imported mesh includes materialUniqueId and materialId that look like this:
Note that it does not include materialName, which would be nice.
My app uses a table of materials that are relatively consistent, but I’m unclear if I can set materialId or materialUniqueId on a material without screwing up some internal references. In other words can I do something like this when creating materials:
let m = new BABYLON.StandardMaterial(mname,scene);
m.Id = mname;
m.uniqueId = myId;
then I can manually associate existing materials with loaded meshes