Help:VE186

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Improved description.)
Line 1: Line 1:
 
'''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.'''
 
'''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.
  
Meshes that can share materials improve game performance, but when meshes within the same asset use the same material name, and the material differs, then that may result in unexpected behaviour.
+
VE186 is a warning for assets with a [http://online.ts2009.com/mediaWiki/index.php/Trainz_Build_Versions Trainz Build] less than 4.5, and an error for assets with a Trainz Build 4.5 and later.
  
The first time the game encounters a material name, that material is loaded with the material parameters that are defined for it. If the same material name is subsequently encountered in a mesh, 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.
+
=Background=
 
+
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.
 
+
VE186 is a warning for assets with a [http://online.ts2009.com/mediaWiki/index.php/Trainz_Build_Versions Trainz Build] less than 4.5, and an error for assets with a Trainz Build 4.5 and later.
+
  
 +
=Automated Workaround=
 +
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.
  
A [http://online.ts2009.com/mediaWiki/index.php/Material_Types Trainz material], intended for use for two or more meshes within the same asset, must be identical for each mesh that uses the material.  This includes material characteristics such as: opacity, ambient, diffuse, specular, emissive and shininess.  Textures, where used in the material, must be the same number of textures, the same image, size, and texture type (TEX_DIFFUSE, TEX_BUMP, etc).
+
=Examples=
  
 
The following examples will result in a warning/error.
 
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 the material specular value.   
+
*  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 a texture is substituted, added or removed, for one of the meshes.  

Revision as of 10:31, 11 October 2017

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.

Background

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.

Automated Workaround

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.

Examples

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.
  • An asset is created with a 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.


Therefore:

  • 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.
Personal tools