# Trainz/Kinds/kind track

Back to the Top
* Trainz Annotated References
* TOC | Beginnings | Fun | AM&C | Creation | InBook Refs | ORP Refs:  • Index • Containers • Kinds • Tags | Appendixes  • Vers
Glossary :
HKeys-CM :
HKeys-DVR :
HKeys-SUR :
HKeys-WIN :
Mouse use :
Notations :

## Legacy Tracks

The Trainz data model has arguably changed most significantly in its track and spline object software treatment from Trainz 1.3 through TANE (which adds significant complications in junctions and script issues with Interlocking towers). This evolution has three to four distinct levels from what was called chunky track through the initial new TANE kind procedural track. Between Trainz UTC & TRS2004 chunky track, bridges and tunnels were obsolesced for a set of kind tracks— new formal definitions of the kind system which included these types (shown here with links to their CCG reference pages): An unbiased table of TRS's/TC's era CCG is to be [found at this url]:
* Kind: FixedTrack
* Kind: Track - Including 'bendy' tagged spline objects
   * Kind: Track (Rails)
   * Kind: Track (Road)
* Kind: Bridge - Single Track
* Kind: Bridge - Tunnel - This kind is used for creating road and rail tunnels.
* Kind: Bridge - Double Track
* Kind: MOCrossing

### Spline objects

* Kind:_Track - Spline scenery assets from crops to roads are defined using various tags to control how the object works with the world.
There were incremental improvements to these, but TS2009's shift to stitched track technology

## KIND Track

KIND Track provides the sole asset kind for ALL spline-based assets from Trainz-build version 2.9 and up (after track stitching processing was made default rendering software). Contrary to the name, just as a Road type was defined as a Track asset, assets of this kind now include simple track, multitrack, bridges, tunnels, hedges, roads, walls, embankments, local power lines, high-voltage power lines, catenaries (and other trackside 'attached track container container' splines), and so on.
Assets of this kind use a rendering technique previously known as "stitched track". Now that all other spline rendering is obsolete, all spline classes of yesteryear are now simply known as "track" and use a variant of kind track with appropriate tags set to implement the digital model. An alternative track type, kind_procedural-track has now been added in the TANE releases (v4.0 and up) which contains the new capabilities of seeing animated junction parts. This page does not directly address this newer technology in TANE.
* This page describes trainz-builds v2.9–v3.7; TANE track is a whole other case, a major data model change and for now, the best source data is in the Auran forums and the N3V Games Wiki's on links:
* KIND_Procedural-track nor KIND_Procedural_track.

## KIND Hierarchy
### Parent Classes

* KIND TrainzBaseSpec , Category-class tag definitions of the sets
{S ... SPLINES and T ... TRACK }, which is to say the Category-class list of spline types:

### Child Classes

* Attached-track is an asset embedded in an industry asset which inherits track characteristics from a track which is attached to its end vertices.

## Supported Tags

The KIND Track in a spline object defining config.txt file supports the following tags when defined by the KIND TrainzBaseSpec. Each tag is show here with its default value.
| mesh-table | |
| track container | (subcontainer) |
| endcap-prev | |
| endcap-next | |
| attached-splines | |
| season-selector | |
| carrate | 0 |
| isroad | 0 |
| isfreeway | 0 |
| is_silent | 0 |
| numlanes | 0 |
| istrack | 0 |
| istunnel | 0 |
| surveyor-only | 0 |
| visible-on-minimap (opposite of surveyor-only) | |
| track-sound | |
| traffic-speed | 10.0 |
| tunnel-roof-height | 0.0 |

## mesh-table

The "mesh-table"_Container "mesh-table"_Container provides details about the track and end-cap meshes which comprise this asset. Most advanced mesh-table options are not available for use at the current time. The important thing is to specify the meshes. Specifically, the 'mesh' tag should be used to specify an IM file, and the 'mesh-asset' tag can be used to specify an alternative source asset for the mesh.

## track

The "track" tag is compulsory and determines how the spline geometry is formed from meshes. It is specified as a Track Part Container.

## attached-splines

The attached-splines container provides a mechanism for having child splines attached which follow the shape of this parent spline at a slightly offset. Attached splines are used where a spline with one set of rendering or functional behaviour needs to be coupled with a spline with a different set of rendering or functional behaviours. For example, a bridge (scenery) with attached track (functional), or a set of pylons (no stretching or shearing) with some wires strung between them (shearing and stretching to fit.) The attached splines may be render-only splines which effectively don't exist beyond their rendering behaviour, or they may be fully functional splines whose only specialty is that they move and delete with their parent.

## endcap-prev & endcap-next

The "endcap-prev" and "endcap-next" tags are specified in the same way, but are not compulsory. If present, these end caps are inserted past the ends of the spline in each direction unless the spline flows onto another spline of the same type. This allows the content creator to "seal" the spline geometry without having to introduce inefficient sealing polygons at each subdivision. The endcaps obey the normal fit-to-spline behavior except that they continue straight in the instantaneous direction of the end of the spline. The endcaps inherit their default settings from the asset's "track" tag but any individual values may be overridden as desired.

## Season-selector

The "Season-selector"_container "Season-selector" container allows for the selection of a season index, which may be used by the "track-lod-tree"_container "track-lod-tree" container.

## isroad

    type: Boolean (1 or 0)
If set (1), splines of this type are considered roads. Roads support the generation of Carz. Roads are flagged as blocked by KIND MOCrossing while the crossing gate is closed. Road splines can generally be joined, even if they are different assets.
If not otherwise specified, assets with the 'isroad' tag set are members of the "Road Spline Group" (<kuid:30501:100045>) (see: Known_Asset-groups in KIND_Asset-group).

### carrate

(Only applicable to splines which have 'isroad' set.)
The game waits between 1x to 3x this decimal value between generating carz on this road, so the lower the number, the more traffic the road will spawn.

## isfreeway

(Only applicable to splines which have 'isroad' set.)
If set (1), this boolean tag causes a multilane road to act as a freeway. This allows carz to change lanes at will, and causes all traffic to flow in the spline's forward direction only. Overtaking is still allowed on non-freeway roads.

## is_silent

(Only applicable to splines which have 'istrack' set.)
If set (1), this boolean tag disables the playing of per-axle sounds for vehicles on the spline.

## numlanes

(Only applicable to splines which have 'isroad' set.)
Defines the number of carz lanes on a road. Each lane is considered to be 1.7 meters wide. If the road is a freeway, all traffic flows in the same direction. TBD: What, if anything, does this mean for a non-freeway road?

## istrack

If set (1), this boolean tag causes the spline to be treated as a "track", meaning that trains can be expected to run on the spline.
This affects the visibility of the spline on the minimap, where the spline assets shows up in the surveyor pickers, which surveyor tools can operator on the asset, and whether automatic junction placement is enabled.
Track splines can generally be joined, even if they are different assets.
If not otherwise specified, assets with the 'istrack' tag set are members of the "Track Spline Group" <kuid:30501:100043>.

## istunnel

If set (1), this boolean tag causes the spline to be treated "like a tunnel". Despite the name, this does not directly relate to the true tunnel spline functionality (see the 'tunnel-roof-height' tag for details.)
Some types of derailment are disabled while in a tunnel because the resultant user experience would be poor due to inter-penentration of the tunnel and terrain by the train vehicles and the player's camera.
The script function Vehicle.IsInTunnel returns 'true' while a vehicle's origin is on a tunnel spline.
If the user is in 'external' or 'auto tracking' camera mode while the camera target is in a tunnel, the camera changes to "tunnel external" mode instead.
While the camera target is in a tunnel, environmental sounds are reduced to 50% volume.
Some types of vehicle particle emitter are disabled while the vehicle is in a tunnel.

## surveyor-only

If set (1), this boolean value causes the asset to be invisible and non-functional in Driver. This is typically used for splines which provide editing assistance, such as templates, markers or rulers.

## visible-on-minimap

If clear (0), hides this spline from the minimap. Splines with non-render-only children are never shown on the minimap. Note that this tag does not have a fixed default value, but rather defaults to the opposite of the 'surveyor-only' tag.

## track-sound

(Only applicable to splines which have 'istrack' set.)
An optional "track-sound" container "track-sound" container which assists in calculating which sound to play while a train vehicle is on this track.

## traffic-speed

(Only applicable to splines which have 'isroad' set.)
Defines the carz speed limit of the road in meters per second. Carz currently travel at up to 80%-110% (depending on the car) of the speed limit, except when overtaking. This tag does not relate to trains in any way.

## tunnel-roof-height

Used by tunnels to determine the roof height in meters allowed by the terrain hole. If less than or equal to zero, no terrain holes are generated. If greater than zero, this spline is considered a true tunnel- it will generate holes in the terrain mesh, its approach angle to the terrain mesh will be locked to 45° increments, and the endpoints will snap to the 10m grid size.
Tunnels are intended for running a spline underneath the terrain mesh.
Tunnel splines attempt to curve such that the spline terminates at a 45° angle increment. This helps ensure that entrance holes can be successfully created through the terrain mesh.
Tunnel splines have slightly modified editing semantics in Surveyor. Vertex markers are visible in different conditions. Smoothing the ground around a tunnel is not permitted. The tunnel spline always follows the spline gradient rather than reacting to the ground height.
If not otherwise specified, assets with the 'istunnel' tag set are members of the "Tunnel Spline Group" <kuid:30501:100044>.

# Meshes

A track asset usually comprises several meshes. Each mesh represents a piece of the spline, which is repeated end-of-end with various transformations in order to create the whole spline. Multiple meshes allow for LOD, detail randomisation, and so on – the selection of which mesh to use at various places on the spline is defined by the "track-lod-tree" container "track-lod-tree" containers.
Meshes should make use of a normal map and a single high-resolution diffuse texture. For performance reasons, a single material (ie. single texture; see the notes on material sharing between meshes) should be used for all meshes, as opposed to using a separate material for each. The material may use either alpha masking (1-bit alpha) or alpha blending, however any alpha blends will not be sorted (not against other polygons in the track itself, nor against other alpha-blended polygons in the scene.) For this reason, alpha blending should only be used low to the ground such that a line from the camera to the mesh will pass through no other alpha-blended object before reaching the ground. Normal z-buffer behavior will apply to both alpha-blended and alpha-masked meshes.
The various mesh pieces that comprise a track are modelled in such that any type may fit to any other without an obvious seam. Pieces are not strictly required to be symmetrical, as they will never be rotated with respect to the previous piece, however it should be noted that splines which support multi-way joins can result in a construct where a spline loops back and connects to itself coming in the opposite direction.
Some approximate polygon guidelines follow. Creators should avoid using more polygons that they require to accurately depict the object in question.
* Extreme detail mesh - used for close-ups. 1000 polys per 2 m segment.
* High detail mesh - used at close range. 200 polys per 2 m segment.
* Mid detail mesh - used at mid range. 100 polys per 10 m segment.
* Low detail mesh - used at far range. 6 polys per 10 m segment. Tracks are textured onto the ballast, rather than polygon-modelled.
* Initial end-cap - used at the start of the spline. 100 polys.
* Final end-cap - used at the end of the spline. 100 polys.
The end-caps provide any polygons necessary to "close" the spline so that it does not appear hollow when seen from end-on. The other meshes do not include any such polygons. The end-caps are automatically applied by the game wherever a transition is made from one track type to another, or where the track begins or ends abruptly.
The length of each mesh is specified independently. It is recommended that each is made as long as reasonably possible within the allotted polygon budget.
When modelling a track spline, care should be taken to ensure that the top of the rail is exactly 0.3 m above the origin. This ensures that it meets the train vehicle's wheels with no overlap and no gap.

# Spline Placement

Meshes may be specified to follow their placement spline as closely as possible (previously: bendy) or to stay straight but shear to prevent seams. This is discussed in detail in the "track-lod-tree" container "track-lod-tree" container.
Vertices on the mesh may fall into one of two height categories:
* Grounded – The vertex positioning is based on the ground height.
* Spline – The vertex positioning is based on the placement spline.
The height category of a vertex is determined from its relative height within the mesh – if it is less than or equal to the per-mesh-specified grounding height, it is considered grounded.

# Performance

Actual performance will vary based on the following factors:
* Distance at which the High-detail LODs drop out. Generally this should be extremely close.
* Number of polygons in the lower LODs. Generally this should be very low.
* Number of materials used. Ideally, a single material is used for all meshes, rather than one or more per mesh.
* Length of each mesh (longer is better).
* Efficiency of the "track-lod-tree" container "track-lod-tree" container.
* User-customisable detail settings.
* etc.

## Downloads

* Media:TS2009-track.zip - The MAX source for the Auran TS2009 example track. Distributed from the TrainzDev site for education purposes only. No license for the reproduction or redistribution of the included model or textures is granted.
* Media:TS2012-tunnel.rar - The MAX source for asset: Tunnel Double Track <KUID:523:19721248>. Distributed from the TrainzDev site for education purposes only. No license for the reproduction or redistribution of the included model or textures is granted.
* Media:TS2012-bridge.rar - The MAX source for asset: Bridge Plate Girder <KUID:523:19721136>. Distributed from the TrainzDev site for education purposes only. No license for the reproduction or redistribution of the included model or textures is granted.

## See Also/Related Links

* Read the Track entries of the online TC3 Content Creator's Guide.
* "track-lod-tree" container "track-lod-tree" container
* Splines Modeling Splines
* Part Container Track Part Container
* Surveyor Hints

## Notes, Footnotes & References

Config.txt files are endemic and ever present in Trainz assets, for no asset can be defined without this type of Computer Science container. The keyword-value_of_key pairing must always be kept in mind in editing or creating Trainz content. The TrainzBaseSpec contains values and containers which are most common in asset defining config.txt files.

### Notes

* ↑ This link, with it's hyphenated name is the more correct, but as of this notation date, the page KIND_Procedural-track does not exist.

### Footnotes

* ↑ TC3 CCG index as put up by PEV before Windwalkr broke links: http://online.ts2009.com/mediaWiki/index.php?title=Content_Creator%27s_Guide&oldid=2738
* ↑ "attached-splines"_container "attached-splines" container

### References

* Trainz printed or pdf file Manuals, applicable version - usually in the ..\extras or ..\extras\manuals folder
* TrainzOnline Wiki Config.txt file page and various other pages
* TrainzOnline Wiki: Content Creator's Guide pages (various)
* Various CCG and Auran websites