Category code 'ZX - Material 'arc:fld:$(local)/hash-nn||kuid nnnnn nnnnn.tzarc|**material name is shared between multiple meshes in this asset but the material parameters conflict.
Material sharing is a recommended technique for improving performance. This asset contains meshes which share materials, but which are configured such that material sharing is inappropriate and will introduce unwanted and undefined behaviour. The resulting visual faults may be subtle or substantial, and may give different results on each run or on different Trainz installs.
VE186 is a warning for assets with a Trainz Build less than 4.5, and an error for assets with a Trainz Build 4.5 and later.
Trainz may also show diagnostic messages before this warning/error. These diagnostics will help identify which material attributes are mismatched.
The first time the game encounters a named material in a given asset, that material is loaded with the material parameters that are defined for it (including texture slots and lighting parameters). If the same material name is subsequently encountered in another chunk or mesh of the same asset, then a new material is not loaded - the parameters already loaded are used. Those parameters might not be what was intended for that second material, and the rendering of the asset might therefore be incorrect. Also, as the sequence of loading meshes is not predictable, the resultant rendering will vary in different circumstances. To obtain correct, consistent rendering of the asset it is important to ensure that each material is loaded with the correct parameters for that material.
Newer versions of Trainz will attempt to detect and work around this problem at runtime on older assets, by disabling material sharing for the assets. This workaround may reduce performance, but may help to stabilise the visual result. This workaround may or may not give the visual result that the content creator had in mind when they created the asset. For newer assets, this problem is simply considered an error. In either case, it is recommended that the content creator fix the problem so that the result is well defined and performs as expected.
The following examples will result in a warning/error.
- An asset uses the same material name for three different LOD meshes. Two meshes are exported with one version of the material but the last is exported with a variation, such as a different material specular value.
- As for the first example, but a texture is substituted, added or removed, for one of the meshes.
- As for the first example, but the two conflicting meshes are generic meshes (eg, an attachment mesh and a shadow mesh) that use the same material name and the materials in the two meshes have different property values. The error is reported even though there is no texture resource for the material.
- An asset is created with two meshes both within their own source file. The same notex material name is used for both meshes but there is a variation in the diffuse colour.
- Do not use the same material name if the materials should have different parameters.
- If you use the same material name in different meshes then ensure that the material parameters are the same.
- Avoid material names (eg 'black_m') that are common in generic meshes that might subsequently be added to the asset.