"track-lod-tree" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (Branch Node)
m
Line 1: Line 1:
 
This page currently describes the trainz-build 3.5 config format.
 
This page currently describes the trainz-build 3.5 config format.
  
The "track-lod-tree" container is a top-level [[config.txt file]] entry used by the TS2009 [[Stitched track]].
+
The "track-lod-tree" container is a top-level [[config.txt file]] entry used by [[KIND Track]].
  
 
The track-lod-tree is a recursive format which describes a binary tree structure. When stitching the track geometry, Trainz breaks the spline up into smaller parts (determined by the track's ''mesh-length'' tag) and then parses the track-lod-tree to determine which meshes to use.
 
The track-lod-tree is a recursive format which describes a binary tree structure. When stitching the track geometry, Trainz breaks the spline up into smaller parts (determined by the track's ''mesh-length'' tag) and then parses the track-lod-tree to determine which meshes to use.

Revision as of 16:32, 24 September 2012

This page currently describes the trainz-build 3.5 config format.

The "track-lod-tree" container is a top-level config.txt file entry used by KIND Track.

The track-lod-tree is a recursive format which describes a binary tree structure. When stitching the track geometry, Trainz breaks the spline up into smaller parts (determined by the track's mesh-length tag) and then parses the track-lod-tree to determine which meshes to use.


Contents

Supported Tags

Each node in the track-lod-tree supports the following tags. Each tag is shown here with its default value.

mesh ""
subdivisions 1
lod-distance 0.0
lod-length 0.0
lod-tessellation-length 0.0
lod-random-bias 0.0
lod-is-surveyor 0
lod-season-index 255
high-detail
{
}
low-detail
{
}

Each node may either select a mesh from the "mesh-table" Container, or may branch into two new nodes.

The subdivisions tag indicates that the specified data is to be used for several repeats. Exactly how this affects rendering depends on the node type and is detailed below. Trainz may choose to render only some of the repeats in specific scenarios such as very short track lengths - the details of this should overly concern the content creator.


Mesh Node

The mesh node selects a single mesh from the "mesh-table" Container, which is always used. It does not specify a .IM format file directly.

subdivisions 1
mesh "track-lod2"

The subdivisions tag causes the mesh to be repeated the specified number of times.


Branch Node

The branch node specifies a high-detail and a low-detail path, and provides information for Trainz to choose between them.

subdivisions 4
lod-distance 100.0
lod-length 10.0
lod-tessellation-length 6.0
high-detail
{
  ..
}
low-detail
{
  ..
}

Each of the high-detail and low-detail paths is another "track-lod-tree" container, causing this structure to be recursive.

The subdivisions tag causes the current track part to be subdivided into multiple parts, which continue to be passed through the track-lod-tree. Each part may take a separate path through the tree, however they all start at the current tree node and move downward (ie. they do not re-parse from the root of the tree.)

The lod-distance tag determines the distance (meters) at which Trainz will swap to using the lower detail path. This distance is a guideline and may be affected by user performance settings.

Track parts are scaled to some extent based on the length of the Track Stretch being generated and the mesh-length tag. The lod-length tag provides a mechanism for forcing the high-detail path for short parts, even when the low-detail path would be appropriate given the distance. Specifically, if the generated geometry will be shorter than the lod-length setting, the high-detail path is chosen. This tag should be used with extreme caution, since it has the potential to ruin the LOD scheme and thus kill performance. This tag should only be used to select between a long (efficient) low detail mesh and multiple short (less efficient) low detail meshes, and never to force a change to an actual high detail mesh.

Trainz determines a desired tessellation length based on factors which include the ground bumpiness and the bend angle of the spline. The lod-tessellation-length tag provides a mechanism for forcing the high-detail path for track parts with high tessellation requirements. The length (m) specified in this tag refers to the distance between tessellation points in the mesh, not to the whole length of the mesh. For example, a lod-tessellation-length of 6.0 indicates that the low-detail path is suitable for tessellation at around six meters, whereas the high-detail path is required for tessellation finer than six meters. The high detail path in this case should generally look identical to the low detail path, but with slightly increased tessellation along the Y-axis. This allows Trainz to increase tessellation without the cost of changing to an actual high detail mesh.

The lod-tessellation-length branch should ideally be specified as deep in the track-lod-tree as possible, as Trainz may refine this data as it progresses through the tree - the more parameters that have been set in stone before tessellation is considered, the more accurate the tessellation process will be.

The lod-random-bias isn't really a LOD scheme and instead allows for random selection between the high or low "detail" paths. At the default setting of 0.0, this has no effect. As the number is raised toward 1.0, the chance of forcing the high "detail" path is increased. At 1.0 or higher, the high detail path would always be chosen. While this tag can be used in tandem with other lod-* tags, the behavior is somewhat arbitrary so this isn't recommended. A value of 0.5 gives a 50% variation between high and low "detail" paths.

The lod-is-surveyor isn't really a LOD scheme and instead allows for the display of different meshes in Surveyor (editing mode) versus Driver (gameplay mode.) When set to '1', this tag causes the high "detail" path to be chosen when in editing mode.

The lod-season-index isn't really a LOD scheme and instead allows for the display of seasonal meshes. When a specific season index (as per the "Season-selector" container) is specified, this tag causes the high "detail" path to be chosen when that season is current.

Examples

TBD

Personal tools