"mesh-table" container

From TrainzOnline
Revision as of 11:36, 14 October 2013 by Fabartus (Talk | contribs)

Jump to: navigation, search


KIND Heirarchy

The "mesh-table" container is a top-level config.txt file entry used by various Content Types.

The mesh-table is a list of mesh subcontainers with no standalone tags. Each mesh subcontainer uses the following format. Tags are parsed in a standardised format, but not all Content Types support the full range of tags listed below. Each mesh derives its name from the subcontainer's tag name. These names are used to refer to specific meshes from within the mesh-table and also from script.

Known Dependent Parent Types

Main article, see: KIND Mesh

The Content Types listed here use the mesh-table container as part of their definition.

The following config containers also reference back to their Asset's mesh-table container in some fashion:

See also
 • Modeling Guidelines  • Modeling Scenery

Mesh subcontainer

Each mesh subcontainer supports the following tags. Each tag is shown here with its default value.

  • The term 'filenamespec' is meant to convey the local pathspec (folder and subfolders) below the base folder of the asset (i.e. when opened for edit in Windows Explorer).
mesh-asset                           <NULLKUID>
mesh                                 "text=path and name/ident"
anim                                 "text=path and name/ident"
lod-level                            255
mesh-season                          255
att                                  "text=a.some-attachment"
att-parent                           "text=filenamespec: some-mesh.im" *
opacity                              1.0
position                             0,0,0
orientation                          0,0,0
auto-create                          0
use-parent-bounds                    0
animation-loop-speed                 0
critical-animation                   1
effects  {
night-mesh-base                      "text=filenamespec of ..."

* The att-parent defaults to "default" which is the parent mesh. The att-parent tag can include a path.

Supported Tags

Each mesh subcontainer supports the following tags.


Allows assets to be used as 'mesh libraries', the following container specifies that the mesh required (and its optional animation) is located relative to 'the root folder' of <kuid:1234:5678>. CMP does not auto-check for the existence of these 'externally referenced files' when processing so you must ensure that they are present in the referenced kuid before using this tag. Subfolder paths within the asset can be used; folder names should be prefixed to the path with a forward slash ("/") separator in the usual fashion.


The ‘main’ mesh name. This may include a sub-path; ie: mesh nightwindows/nightwindows.im, where the file nightwindows.im has been placed in the subdirectory nightwindows.

Use .im files exported from 3dsmax (as opposed to .pm.) or reference an .lm file if you wish your asset to have ‘Level of Detail’ mesh reduction.

Level of detail is a process of using different model meshes, depending on how far the viewer is from the model. A finer mesh is used for close up viewing in Trainz.


The animation file (.kin) exported from 3dsmax. This may include a sub-path.


The object LOD level at which this mesh is displayed. The default value (255) indicates that this mesh is visible at all detail levels. See also KIND Mesh for the 'mesh-detail-level' tag.


The season index for which this mesh is displayed. The default value (255) indicates that this mesh is visible in all seasons. See also "Season-selector" container.


The mesh (and animation if present) is inserted at a mesh attachment point rather than the origin (without this line the mesh is placed relative to the origin of the parent model).


The tag tells Trainz in which mesh the attachment point is located. The insertion attachment point is located within the mesh ‘name’ , as listed in the config.txt.


opacity x (float 0.0 - 1.0 default 1.0)

Specifies the overall transparency of a mesh. Values other than 0.0 or 1.0 employ alpha blending and a value of 0.0 has the same effect as hiding the mesh.

Note that this tag is buggy in TS2009 prior to SP4.


This tag defines a minimum and maximum scaling value for the mesh, where 1.0 is the size as modelled. Each instance of the mesh that exists in the world will randomise within this range. Randomisation will not change between runs or between Trainz editions, but may change based on factors such as the position of the mesh in the world. This tag is currently only supported on SpeedTree assets; attempts to use this tag on other assets results in undefined behaviour.


position X,Y,Z (in metres, default 0,0,0)

Specifies the location of a mesh relative to its insertion point.


orientation X,Y,Z (radians default 0,0,0)

Allows a submesh to be rotated relative to its insertion point. To reverse a mesh by 180 degrees about the Z axis, add the tag:

orientation 0,0,3.14159


The model is generated automatically when placed, or when you load a map which includes the model. In some instances you don’t want the mesh visible (as this may be controlled through script). If auto-create is 0 the mesh will not be visible when placed.


When enabled, this tag indicates that render culling should occur using the whole object's bounding box rather than this mesh's bounding box. Bounding boxes on individual meshes may not update correctly when animation moves the object's geometry any significant distance from the bind position. This flag can help mitigate such effects, at a tiny performance penalty.


This tag must be here if the asset is to animate when placed. If this tag is not here when placed the animation will not play by default, but may play if controlled by script. A different value (e.g. 0.5, 2.0) may be used in the tag to play the animation at a different speed from that created in 3dsmax.


If set (which it is by default), this tag causes the non-stitched mesh to be linked into the Trainz lighting model. This causes the mesh to respond to directional lighting changes, such as the angle of the sun or train headlights. This is also necessary for normal maps to work correctly. Zeroing this tag will remove the mesh from the Trainz lighting model. Generally speaking, you should never zero this tag- almost every effect that can be achieved through this approach can be better served by using an appropriate normal map or appropriate geometry detail.

This tag has no effect on stitched meshes, which are always affected by the Trainz lighting. Since the content creator has no direct influence over which meshes are subject to Mesh Stitching, and all indirect influences are subject to change between Trainz editions, it is strongly recommended that this tag is avoided to ensure that results are consistent.


"critical-animation" indicates that this mesh's animation generates events which are critical to the script system's behavior. If your asset is not scripted, does not use scripted animation events, or only uses the events for display purposes and will not break if the occasional event is missed, this tag should be set to false. Leaving this flag set to true is a significant performance penalty.


This night mesh is linked to the specified mesh and is visible only at night. It is invisible if the specified mesh is invisible, (if the auto-create 0 line were used so the specified mesh can be controlled by script).

Effects Container

The effects container also contains a list of effect subcontainers. The effect subcontainers support the following generic tags.

kind ""
name ""

The effect subcontainers support additional tags depending on the effect kind. The following effect kinds are supported:

Mesh-Table Example

The following is an example of a simple mesh-table which implements two levels of detail.

    mesh "example-lod0.im"
    auto-create 1
    lod-level 0
    mesh "example-lod1.im"
    auto-create 1
    lod-level 1
Personal tools