Version 4.3.0

Version 4.3.0 Details

List of all changes

Material cloning on mutation

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:

  • Material naming convention inside the 3d model gets lost
  • Scene (and potentially GLB export) size increases due to higher amount of materials
  • Texture optimizations potentially get lost (eg: material clone creates PNG from original JPG texture)

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.

It is recommended to disable material cloning, as it is advantageous for the development process and the viewer performance as well. Just make sure that adjustable meshes don't share the same material, as material mutations will affect every mesh that is assigned to it.

Adjust naming of cloned materials

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