In versions pre 4.3.0
, parameter modifications that affect materials (eg: color
, metallic
, roughness
, ...), were not directly applied on the original material that was delivered with the mesh from the input GLB or babylon file.
Instead the original material got cloned on the first modification and every further change was applied on that material copy.
The reason behind this was to avoid side effects from the material adjustment for other meshes. If the same material was assigned to multiple meshes, a material change for mesh 1 would also affect the material of mesh 2, which is an undesired behaviour in most of the cases.
However this approach has some drawbacks as well:
In order to get rid of these implications it is now possible to deactivate material cloning by setting the cloneMaterialsOnMutation
flag to false
within the Spec (see SceneJson
).
return {
scene: {
//...
cloneMaterialsOnMutation: false,
},
// ...
}
Due to backwards compatibility the default value of cloneMaterialsOnMutation
is true
.
As described in the chapter above, material clones got created on the first material parameter modification.
These clones got very generic names, like node.102
, which made it very difficult to analyse the origin of the material.
In order to help finding the original material again, the material clone name now starts with the name of the original material, followed by the keyword clone
and the unique id of the mesh.
For example the material clone of a mesh with an original material name of SeatSport
was previously named something like node.102
, whereas now it is called SeatSport.clone.102
.
This of course only applies if material cloning is active (cloneMaterialsOnMutation
flag).
Generated using TypeDoc