HowTo/Build Procedural Track for T:ANE

From TrainzOnline
Jump to: navigation, search

Track Asset Requirements for Procedural Junction Support

T:ANE introduces a new track component structure that can be configured to support automatic procedural modification wherever junctions are encountered. To enable this feature a track asset of KIND Procedural-track is required. Unlike KIND Track, the individual components are exported as separate assets, ideally derived from a single mesh library.

Ballast

The ballast spline is the parent or base asset to which the other components are attached using the attached-splines container. Endcaps for the other components can be combined into a single mesh in the parent asset. When converting from a KIND Track asset the existing track-lod-tree can be retained for the ballast spline.

The correct position of the mesh relative to the origin in the 3D modeling environment. Spline rendering starts at the origin and proceeds along the -Y axis:

PT img1.png
Basic configuration of the Ballast asset is as follows:

kind                                	"procedural-track"
istrack                             	1
trainz-build                        	3.9
track-type                          	"ballast"

The attached splines container is configured as follows:

attached-splines
{

  sleepers
  {
	lateral-offset                  	0
	use-same-direction              	1
	spline-kuid                     	<kuid:523:19723515>
	visual-only                     	1
  }

  chairs_left
  {
	lateral-offset                  	-0.751
	use-same-direction              	1
	spline-kuid                     	<kuid:523:19723516>
	visual-only                     	1
  }
 
  chairs_right
  {
	lateral-offset                  	0.751
	use-same-direction              	1
	spline-kuid                     	<kuid:523:19723517>
	visual-only                     	1
  }

 
 rails_left
  {
	lateral-offset                  	-0.751
	use-same-direction              	1
	spline-kuid                     	<kuid:523:19723518>
	visual-only                     	1
  }
 
  rails_right
  {
	lateral-offset                  	0.751
	use-same-direction              	1
	spline-kuid                     	<kuid:523:19723519>
	visual-only                     	1
  }
}
 

lateral-offset: defines the number of metres that the child spline is offset sideways from its parent's origin. Positive values offset to the right, and negative values offset to the left.

use-same-direction: causes the child spline to face in the same direction as the parent. (see on the wiki)

spline-kuid: unique identifier for the attached spline asset.

visual-only: Removes the functional aspects of the child spline, preventing for example, the ballast and the rail splines being treated as separate stretches of track. Also prevents undesired manual editing of the individual components in Surveyor.

Sleepers (Ties)

The sleeper spline is a child of the ballast spline, attached using the attached-splines container in the ballast spline. The spline consists only of 3D sleepers. Meshes can be culled as desired at lower lods simply by specifying no mesh at the low-detail node of the track-lod-tree. To preserve the correct spacing at the desired mesh length some additional tags are available.

Basic configuration of the Sleeper asset is as follows:

kind                                	"procedural-track"
istrack                             	0
trainz-build                        	3.9
track-type                          	"sleepers"

 

The mesh-table for the sleeper asset includes a single sleeper instance which is used by the procedural junction system. The sleeper_single mesh is not referenced through the track-lod-tree. The term sleeper_single is specifically required in the mesh-table, the mesh file itself can be named as desired. The sleeper_single mesh is always used under junctions, the track-lod-tree is always used when not inside a junction. For this reason, we recommend you provide different lengths of spline section in the track-lod-tree, including down to a single sleeper length.

We do not currently support LOD on the sleeper_single mesh. This is planned in future. Do not use a .lm.txt file - this will stop the track from stitching, and make it slower.

mesh-table
{
  sleepers-lod0
  {
	mesh-asset                      	<kuid:523:19723520>
	mesh                            	"sleepers_lod0.im"
  }
 
  sleepers-lod1
  {
	mesh-asset                      	<kuid:523:19723520>
	mesh                            	"sleepers_lod1.im"
  }
 
  sleeper_single
  {
	mesh-asset                      	<kuid:523:19723520>
	mesh                            	"sleeper_single.im"
  }
}

 

Some extra tags in the track container are used to set the desired position of the sleeper mesh...

fig.b - the correct position of the mesh relative to the origin in the 3D modeling environment.
fig.c - the position as adjusted in the spline’s track container for correct sleeper spacing.
PT img2.png
Note the use of the tags spacing-length-before and spacing-length-after in the track container below. Note also that no mesh has been specified at the lowest detail node in the track-lod-tree. This can be used to transition from 3D sleepers to 2D sleepers that are simply textured on to the ballast spline.

track
{
  mesh-length                       	                3
  spacing-length-before             	0.2
  spacing-length-after              	0.2
 
  track-lod-tree
  {
     lod-distance                    	              200
	
     high-detail
     {
         lod-distance                                 50
  	
         high-detail
         {
            mesh                                        "track-lod0"
         }
  	
         low-detail
         {
         mesh                        	               "track-lod1"
         }
     }
	
     low-detail
     {
     }
  }
 

PT img3.png
The tag sleeper-pitch determines the spacing of single sleepers at junctions. It is measured from the centre of a sleeper to the centre of the next sleeper. The sleeper-pitch is only used for the junctions. It is not relevant for plain line tracks.

The privileges container is used to prevent the asset from being displayed in the Surveyor asset picker:

privileges
{
  permit-listing                    	0
}
 

Chairs-left / Chairs-right (Plates)

Separate left and right splines for rail chairs or baseplates are children of the ballast spline, attached and laterally offset using the attached-splines container in the ballast spline. These splines consist only of 3D chairs. Configuration is similar to the sleepers spline above in that meshes can be culled as desired at lower lods; and the correct spacing between repeats is achieved using the tags spacing-length-before and spacing-length-after in the asset’s track container. This will also ensure that chairs and sleepers are correctly aligned.

fig.e - the correct position of the mesh relative to the origin in the 3D modeling environment.
fig.f - the position as adjusted in the spline’s track container for correct chair spacing.
PT img4.png

Personal tools