Making your own track sections is not very difficult if you have experience making scenery objects. Track shapes are ordinary objects but with some special rules regarding texturing and animation of switches.

Creating the shape

To fit the other track sections and the dynamic track visually you should follow this profile.

 
'A' gauge
'N' gauge
'UKN' gauge
A
0.15
0.09
0.075
B
0.125
0.075
0.0625
C
1.435
0.861
0.7175
D
0.2
0.2
0.26
E
5.0
3.0
2.5
F
8.0
-
-
G
2.0
-
-

 

The origin should be located at the start end of the shape. If you are using TSM this results in a problem where the shapes dissapears in some viewing angles because of fault with TSM. The problem is easily solved by manually editing the shape file. One of the first sections in the file is named 'volumes' (example from a1t10mStrt):

volumes ( 4
  vol_sphere (
    vector ( 0 0.2625 5 ) 5.87005
  )
  vol_sphere (
    vector ( 0 0.2625 5 ) 5.59052
  )
  vol_sphere (
    vector ( 0 0.2625 5 ) 5.59052
  )
  vol_sphere (
    vector ( 0 0.2 5 ) 5.59017
  )
)

The last number in each row (red) should be a little larger (~10%) than the largest (blue) of the others or . This example is OK.

Another problem with own built track sections is that they might not look proper regarding light and shadows. If an engine standing on top of the track section does not cast a shadow on the track but on the ground beneath the track you need to make another change in the shape file in the section named 'prim_states' (example from a1t20mStrt):

prim_states ( 2
  prim_state No_Name_SolidNorm ( 00000000 0
    tex_idxs ( 1 0 ) 0 0 0 0 1
  )
  prim_state No_Name_AlphNorm ( 00000000 1
    tex_idxs ( 1 1 ) 0 0 0 0 3
  )
)

You must find the 'prim_state' associated with the track bed, usually the only one with 'AlphNorm', and change the last number to a three (red). Depending on how you built your shape there could be more than two prim_states and several with 'AlphNorm'. If you name your parts the name will appear instead of 'No_Name'.

Animating switches

Building a switch you must make an animated object. The main object can be named anything you want (I name it 'TRACK'). The moving part should also have a name. Again it can be named anything, I call it 'MOVINGTRACK'. Tests have shown that it's possible to have more than one moving part thus you should have no problem even if your switch has a complicated working. The structure should be flat with the track as parent and all moving parts as children to it. Looking at the shapes of the included points you can see that the animation should have 3 frames. First and last frame should be of the switch in its original position, middle frame when it's in the 'other' position. How you do the animation is up to you as long as there is an animated part.

Texturing

When texturing you should use the standard textures used by the other track sections (dual/narrow gauge has the same textures but with a 'D'/'N'/'UKN'-prefix respectively).

ACleanTrack1 - trackbed texture
ACleanTrack2 - rails and water
ATrackTunFloor - tunnel floor
ATrackTunWall - tunnel walls

Trackbed for straights can be textured using part texturing tiling the texture to fit. Curves and switches need to be textured each polygon if using TSM. It's easier to get a good result if you split the trackbed along the middle and texture left and right halfs separately. More capable modelling tools you can first texture the track and then bend it.

Testing and deploying

To use the shape you need to add an entry for it in the global tsection.dat file describing the track path and identifying the shape-file. If you like to share it with others I suggest you get your track section(s) included in the standardised tsection.dat. Send an e-mail to tsection@train-sim.com with your shapes, any additional textures and the entries you want added to the tsection.dat. You may also contact me for possible inclusion in future XTracks distributions. Please do not distribute your own version of tsection.dat as this file is vital for the operation of all the routes and changes to it (even if made correctly) could have disastrous effects.


2003-12-21