Track Part Container
m (1 revision) |
(→coordinate-transformation) |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | A [[Track Part Container]] is a [[config.txt file]] entry used by the [[ | + | A [[Track Part Container]] is a [[config.txt file]] entry used by the [[KIND Track]] content type. It does not correspond to a single specific tag, but rather is a format which is reused by several different tags. |
+ | |||
+ | This page describes [[trainz-build]] 4.5. | ||
+ | |||
==Supported Tags== | ==Supported Tags== | ||
Line 8: | Line 11: | ||
adjust-height-to-ground-offset 0.0 | adjust-height-to-ground-offset 0.0 | ||
adjust-cross-section-to-ground 1 | adjust-cross-section-to-ground 1 | ||
− | |||
track-lod-tree | track-lod-tree | ||
{ | { | ||
} | } | ||
coordinate-transformation "spline" | coordinate-transformation "spline" | ||
+ | follows-spline-gradient 0 | ||
+ | follows-ground-height-at-ends-of-mesh 0 | ||
+ | dont-scale-mesh-to-fit-length 0 | ||
+ | padding-length 0 | ||
+ | spacing-length-before 0 | ||
+ | spacing-length-after 0 | ||
+ | use-superelevation 0 | ||
+ | endcap-outside-spline 1 | ||
====mesh-length==== | ====mesh-length==== | ||
Line 25: | Line 35: | ||
Typically, this height adjustment is used when building a bridge or similar structure - the bulk of the model is maintained at the actual spline height, but the bottom vertices of the legs or supporting pillars are dropped to ground height. | Typically, this height adjustment is used when building a bridge or similar structure - the bulk of the model is maintained at the actual spline height, but the bottom vertices of the legs or supporting pillars are dropped to ground height. | ||
+ | |||
+ | The offset and threshold values can be used where a spline consists of a base, which should always display at ground level at a fixed size, and a pylon or tower structure above the base with a height that varies with spline height above ground. Set the adjust-height-to-ground-threshold to a value that falls in the section of mesh that is above the base portion (the pylon) and set the adjust-height-to-ground-offset to the negative of the z-value of the lowest vertex of the base. The base will be positioned at ground level, the vertices between the bottom vertex of the base and the threshold value will be positioned relative to the ground, and the vertices above the threshold will be positioned relative to the spline height. | ||
====adjust-height-to-ground-offset==== | ====adjust-height-to-ground-offset==== | ||
Line 35: | Line 47: | ||
If clear (0) the mesh will assume the ground height from the center point. | If clear (0) the mesh will assume the ground height from the center point. | ||
This setting has no effect on vertices which are within the adjust-height-to-ground-threshold range. | This setting has no effect on vertices which are within the adjust-height-to-ground-threshold range. | ||
− | |||
− | |||
− | |||
====track-lod-tree==== | ====track-lod-tree==== | ||
Line 45: | Line 54: | ||
The coordinate-transformation setting determines how vertices from the model are mapped into the world. The following techniques are available: | The coordinate-transformation setting determines how vertices from the model are mapped into the world. The following techniques are available: | ||
− | * "spline" (default) - this option gives | + | * "spline" (default) - this option gives the default, fit-to-spline behavior. |
− | * "linear" - this option gives | + | * "linear" - this option gives simple linear scaling. This will not attempt to shear the ends of the mesh to fit the neighbors. |
− | * "shear" - this option gives | + | * "shear" - this option gives simple linear scaling. This will 'shear' (linear stretch) the ends of the mesh to fit the neighbors. |
+ | * "horizontal" - this option gives an effect similar to 'linear' except that height is fixed throughout a given component mesh. This is useful if lack of vertical distortion is more important that meeting end-to-end with the next mesh. | ||
+ | * "horizontal-shear" - this option gives an effect similar to 'shear' except that height is fixed throughout a given component mesh. This is useful if lack of vertical distortion is more important that meeting end-to-end with the next mesh. | ||
+ | |||
+ | Example: | ||
+ | [[File:SplineOptions.tga|alt=Examples of a spline configured with different coordinate-transformation options.]] | ||
+ | |||
+ | ====follows-spline-gradient==== | ||
+ | If this boolean value is set (1), the mesh is deformed to smoothly follow the height-gradient of the spline. | ||
+ | If clear (0), the mesh is instead deformed to follow the ground height along the centre-line of the spline ("adjust-cross-section-to-ground 1") or under each vertex ("adjust-cross-section-to-ground 0"). | ||
+ | Certain in-game state, such as having set a height gradient onto the spline (yellow track vertices in Surveyor) or residing on a parent bridge spline, may override this option. | ||
+ | |||
+ | ====follows-ground-height-at-ends-of-mesh==== | ||
+ | If this boolean value is set(1), the spline height is effectively deformed such that the end-points of each repeat of the mesh follow the ground height. Spline height throughout the mesh varies in a linear fashion. | ||
+ | If clear (0), the spline height is not affected. | ||
+ | Certain other options, such as ("follows-spline-gradient 0") or ("coordinate-transformation spline") may cause this option to be largely meaningless. | ||
+ | |||
+ | ====dont-scale-mesh-to-fit-length==== | ||
+ | If this boolean value is clear (0), the length of each component mesh is scaled to fit the available area in the spline. Since the number of repeats and subdivisions is integer, spline meshes are typically stretched or contracted slightly to ensure that the mesh repeats end-to-end. | ||
+ | If set (1), the mesh is rendered at its natural length, even if this means that meshes will overlap or stretch apart and not touch each other. This might typically used where a spline represents a set of repeating poles or pylons, rather than a continuous beam. It is also commonly used for the spline endcaps, which are often modelled to a fixed size and should not be stretched or contracted. | ||
+ | |||
+ | ====padding-length==== | ||
+ | A distance (meters, float, default 0) to use for spline repeat padding. Padding meshes are intended to fill in for full-sized repeats at the start of a procedural track where the mesh-length does not divide evenly. This technique is complicated and may not work as intended; it is not recommended at the current time. | ||
+ | |||
+ | ''This tag was introduced at trainz-build 4.2.'' | ||
+ | |||
+ | ====spacing-length-before==== | ||
+ | A distance (meters, float, default 0) which is left empty within each mesh repeat before the geometry. This spacing exists within the 'mesh-length' leaving less available space for the actual mesh. | ||
+ | |||
+ | This value cannot be negative. | ||
+ | |||
+ | ''This tag was introduced at trainz-build 4.2.'' | ||
+ | |||
+ | ====spacing-length-after==== | ||
+ | A distance (meters, float, default 0) which is left empty within each mesh repeat after the geometry. This spacing exists within the 'mesh-length' leaving less available space for the actual mesh. | ||
+ | |||
+ | This value cannot be negative. | ||
+ | |||
+ | ''This tag was introduced at trainz-build 4.2.'' | ||
+ | |||
+ | ====endcap-outside-spline==== | ||
+ | If this boolean value is set (default, 1) on an endcap, then the endcap geometry exists beyond the spline. If this boolean value is clear (0) then the spline geometry is inset by the length of the endcap and the endcap resides within the spline. | ||
+ | |||
+ | ''This tag was introduced at trainz-build 4.5.'' | ||
− | |||
Latest revision as of 01:30, 26 August 2019
A Track Part Container is a config.txt file entry used by the KIND Track content type. It does not correspond to a single specific tag, but rather is a format which is reused by several different tags.
This page describes trainz-build 4.5.
[edit] Supported Tags
The Track Part Container supports the following tags. Each tag is shown here with its default value. In some cases, the Track Part Container may inherit the values set on a parent container (excepting the track-lod-tree) rather than using these defaults; see the individual content type descriptions for additional details.
mesh-length 0.0 adjust-height-to-ground-threshold -3.402823466e+38 adjust-height-to-ground-offset 0.0 adjust-cross-section-to-ground 1 track-lod-tree { } coordinate-transformation "spline" follows-spline-gradient 0 follows-ground-height-at-ends-of-mesh 0 dont-scale-mesh-to-fit-length 0 padding-length 0 spacing-length-before 0 spacing-length-after 0 use-superelevation 0 endcap-outside-spline 1
[edit] mesh-length
The mesh-length value is a track distance in meters which defines the basic unit length of track that the track-lod-tree describes. The track-lod-tree may supply a single mesh of this length, or may subdivide the unit mesh-length into a number of smaller mesh pieces.
[edit] adjust-height-to-ground-threshold
Any vertex with a model-space Z value less than this threshold number will be adjusted based on the height of the ground under that vertex.
The math behind the adjustment is roughly as follows:
outputVertexPosition.z = modelVertexPosition.z + adjustHeightToGroundOffset + groundHeight
Typically, this height adjustment is used when building a bridge or similar structure - the bulk of the model is maintained at the actual spline height, but the bottom vertices of the legs or supporting pillars are dropped to ground height.
The offset and threshold values can be used where a spline consists of a base, which should always display at ground level at a fixed size, and a pylon or tower structure above the base with a height that varies with spline height above ground. Set the adjust-height-to-ground-threshold to a value that falls in the section of mesh that is above the base portion (the pylon) and set the adjust-height-to-ground-offset to the negative of the z-value of the lowest vertex of the base. The base will be positioned at ground level, the vertices between the bottom vertex of the base and the threshold value will be positioned relative to the ground, and the vertices above the threshold will be positioned relative to the spline height.
[edit] adjust-height-to-ground-offset
Provides an offset along the model-space Z axis that is used when a vertex is being adjusted to ground height. If set to the negative of the adjust-height-to-ground-threshold value, this will effectively cause any vertex at that height to be dropped to exactly ground level. Any vertex below that height will drop below ground level. Any vertex above that height will not be modified.
By varying the offset, this allows vertices to float slightly above the actual ground height.
[edit] adjust-cross-section-to-ground
If this boolean value is set (1), the track mesh is distorted across its X axis to follow the ground plane upon which it rests. If clear (0) the mesh will assume the ground height from the center point. This setting has no effect on vertices which are within the adjust-height-to-ground-threshold range.
[edit] track-lod-tree
The "track-lod-tree" container is used to select appropriate meshes for runtime mesh stitching.
[edit] coordinate-transformation
The coordinate-transformation setting determines how vertices from the model are mapped into the world. The following techniques are available:
- "spline" (default) - this option gives the default, fit-to-spline behavior.
- "linear" - this option gives simple linear scaling. This will not attempt to shear the ends of the mesh to fit the neighbors.
- "shear" - this option gives simple linear scaling. This will 'shear' (linear stretch) the ends of the mesh to fit the neighbors.
- "horizontal" - this option gives an effect similar to 'linear' except that height is fixed throughout a given component mesh. This is useful if lack of vertical distortion is more important that meeting end-to-end with the next mesh.
- "horizontal-shear" - this option gives an effect similar to 'shear' except that height is fixed throughout a given component mesh. This is useful if lack of vertical distortion is more important that meeting end-to-end with the next mesh.
Example: File:SplineOptions.tga
[edit] follows-spline-gradient
If this boolean value is set (1), the mesh is deformed to smoothly follow the height-gradient of the spline. If clear (0), the mesh is instead deformed to follow the ground height along the centre-line of the spline ("adjust-cross-section-to-ground 1") or under each vertex ("adjust-cross-section-to-ground 0"). Certain in-game state, such as having set a height gradient onto the spline (yellow track vertices in Surveyor) or residing on a parent bridge spline, may override this option.
[edit] follows-ground-height-at-ends-of-mesh
If this boolean value is set(1), the spline height is effectively deformed such that the end-points of each repeat of the mesh follow the ground height. Spline height throughout the mesh varies in a linear fashion. If clear (0), the spline height is not affected. Certain other options, such as ("follows-spline-gradient 0") or ("coordinate-transformation spline") may cause this option to be largely meaningless.
[edit] dont-scale-mesh-to-fit-length
If this boolean value is clear (0), the length of each component mesh is scaled to fit the available area in the spline. Since the number of repeats and subdivisions is integer, spline meshes are typically stretched or contracted slightly to ensure that the mesh repeats end-to-end. If set (1), the mesh is rendered at its natural length, even if this means that meshes will overlap or stretch apart and not touch each other. This might typically used where a spline represents a set of repeating poles or pylons, rather than a continuous beam. It is also commonly used for the spline endcaps, which are often modelled to a fixed size and should not be stretched or contracted.
[edit] padding-length
A distance (meters, float, default 0) to use for spline repeat padding. Padding meshes are intended to fill in for full-sized repeats at the start of a procedural track where the mesh-length does not divide evenly. This technique is complicated and may not work as intended; it is not recommended at the current time.
This tag was introduced at trainz-build 4.2.
[edit] spacing-length-before
A distance (meters, float, default 0) which is left empty within each mesh repeat before the geometry. This spacing exists within the 'mesh-length' leaving less available space for the actual mesh.
This value cannot be negative.
This tag was introduced at trainz-build 4.2.
[edit] spacing-length-after
A distance (meters, float, default 0) which is left empty within each mesh repeat after the geometry. This spacing exists within the 'mesh-length' leaving less available space for the actual mesh.
This value cannot be negative.
This tag was introduced at trainz-build 4.2.
[edit] endcap-outside-spline
If this boolean value is set (default, 1) on an endcap, then the endcap geometry exists beyond the spline. If this boolean value is clear (0) then the spline geometry is inset by the length of the endcap and the endcap resides within the spline.
This tag was introduced at trainz-build 4.5.