Alpha Numbers

From TrainzOnline
Revision as of 14:39, 19 January 2018 by N3vpolsen (Talk | contribs)

Jump to: navigation, search

Contents

Locomotive Numbering

Trainz supports dynamic locomotive numbering for custom content (using alpha-numbers); otherwise known as 'running numbers'.


Digits are modeled as 6 individual rectangular polygons offset from the face of the Loco body (about 5mm). Digit polygons must be texture mapped using the correct texture naming and alpha-number naming conventions as follows:

If one font type used:

Digit textures (digit_1.tga to digit_6.tga) are replaced automatically with alphanumber textures (alphanumber_0 to alphanumber_9).

If two or more font types used:

Digit textures (digit_1a.tga to digit_6a.tga and digit_1b.tga to digit_6b.tga etc) are replaced automatically with alphanumber textures (alphanumber_0a to alphanumber_9a and alphanumber_0b to alphanumber_9b).

Warning: Assets built for TANE 4.1 and later must use texture.txt image specification files.


Locomotive numbering in the game is edited in Surveyor: Trains panel (Train mode) - Edit Properties (the `?' icon).


Automatic rollingstock running numbering is achieved via appropriate scripting.

Refer to the example download files for configuration of Loco numbering digit's. (none found)


Below is the original tutorial as done by Phil_C who is no longer part of the Trainz community.

Alpha Number

In this tutorial you will learn how to create planes in your model and apply textures so you can change the number shown on your model from within Trainz.

Note. To complete this tutorial you will need to have available a model that has already been textured and has an unwrap UVW modifier applied to it.

Alpha Numbers 1. Planes

The first thing that you need to do is create 4 planes 1 segment x 1 segment. This will be where the numbers will be displayed on the locomotive. Create as many planes as required up to a maximum of six. For this tutorial I have created four numbers each 125 wide by 100 long. You will need to rotate the planes 90 degrees in the "X" co-ordinates. Once rotated then you can move the planes next to each other.


2. Alpha number digit textures and mapping

Once you have the planes in location then we can add the textures for the alpha numbers to the planes. You will need to create suitable sized digit textures for each number you have on the locomotive. These textures can be created using any Graphics creation program. In this tutorial I have used 32 x32 pixel tga images. They need to be suitably named using digit_x.tga or digit_xx.tga. For example if you have six numbersin one set then you will need to have digit_1.tga to digit_6.tga (Six numbers is the maximum allowed in Trainz) . If you have more than one set of numbers on the locomotive that are not identical then you will need to have digit_1a.tga to digit_6a.tga for the first set and digit_1b.tga to digit_6b.tga for the second set etc.

Unless each number set is different then you don't need to have a different number for each numberboard. For example the two sets on the front of the locomotive can use the same alpha number and the numbers on the sides of the cab can use another. The maximum running numbers available in Trainz is six from digit_1.tga to digit_6.tga but if you only have four numbers you will only need digit_3.tga to digit_6.tga. The highest number must always be 6 even if you only have one or two numbers applied to the loco / Rollingstoc.

If you have different size planes on your model you will need to have a differnt set of texture files for each size plane.

When I created the textures for the numbers I used a number that represented the actual size of the numbers that I wanted displayed on the numberboard. That way I could see how the numbers would look and check the alignment before I exported the mesh.

Number 1 is digit_3.tga Number 2 is digit_4.tga Number 3 is digit_5.tga Number 4 is digit_6.tga

The digit_x.tga's are never used within Trainz but for TRS2004 you will need to include them in the package as missing textures can cause problems. Once you have all the mesh and mapping complete you can then export the mesh.


3. Alpha number files

Now you need to create the actual alphanumbers. These can be any size as long as they match the digi_x.tga's size. For example if you have 32 x 32 pixel tga digits on the cab side and 16 x 16 pixel tga digits on the numberboards then the alphanumbers will need to match these dimensions. For each different alpha number set you will need ten alpha numbers 0 - 9. For example if you have three different number sets on the locomotive then you will need thirty alphanumbers. 0 - 9 for each different size or color. The alpha numbers will need an alpha channel so that they blend in with the surrounding textures on the locomotive.

The alpha numbers need to be located in the correct directory. If your asset-filename is tutorial then the folder for the alpha numbers needs to be called tutorial_alpha_numbers.


4. Config entries

The final task required to get the alpha number setup to work is to edit the config.txt file.You will need to add the following to the config file either using CMP or manually with a text editor

fonts 3 Change this number to suit the number of different fonts on your locomotive fonts-path

Change this to the location of your alpha numbers minus the _alpha_numbers. The folder MUST have "_alpha_numbers" as the ending of the name of the folder. For example if your fonts are located in a folder called tutorial_alpha_numbers then the fonts path would be as follows

fonts-path "tutorial"


Trouble Shooting

Materials

If you are finding it hard to determine what Material Type to use, here are some options:

For trainz-build 4.6 or greater use m.pbrmetalmasked if you need transparency otherwise m.pbrmetal should be fine. m.pbrmetaldetail if you really want to add some micro detail to them.

For trainz-builds less than 4.6 you will be using one of the legacy shaders like m.tbumptex or m.onetex or really any of them that you fancy.

Look under Material Types for more info.


Fonts

If you are using 1 set of fonts then your config.txt will have this tag in it:

 fonts         1

and you're "XXXX_alpha_numbers" folder must use "alphanumber_0.tga" and "alphanumber_0.texture.txt" ..etc with the .texture.txt file containing:

 Primary=alphanumber_0.tga
 Alpha=alphanumber_0.tga
 Tile=st


If you are using 2 sets of fonts then your config.txt will have this tag in it:

 fonts         2

and you're first font the "XXXX_alpha_numbers" folder must use "alphanumber_0a.tga" and "alphanumber_0a.texture.txt" ..etc with the .texture.txt file containing:

 Primary=alphanumber_0a.tga
 Alpha=alphanumber_0a.tga
 Tile=st

and you're second font the "XXXX_alpha_numbers" folder must also use "alphanumber_0b.tga" and "alphanumber_0b.texture.txt" ..etc with the .texture.txt file containing:

 Primary=alphanumber_0b.tga
 Alpha=alphanumber_0b.tga
 Tile=st

NOTE: when using 2 fonts there is an "a" and "b" at the end of the alphanumber_0X naming conventions. VERY IMPORTANT and can be missed easily.


vehicle-running-numbers Container

The config.txt file should have the vehicle-running-numbers container in it:

vehicle-running-numbers
{
  running-numbers                       "35050-35150"
}

NOTE: This is the native way of doing running numbers. There are Trainz scripts out there that might do it a different way.


Trainz-Build

Make sure the tag trainz-build is correct for what you are trying to do!


Mesh Source Files

Another obvious one that creators get caught out on is to make sure you name your source .tga and texture.txt files correctly:

digit_2.tga digit_2.texture.txt and the .texture.txt file contains:

 Primary=digit_2.tga
 Alpha=digit_2.tga
 Tile=st

digit_3.tga digit_3.texture.txt and the .texture.txt file contains:

 Primary=digit_3.tga
 Alpha=digit_3.tga
 Tile=st

...etc


Mesh-Table "Default" Container

Make sure the mesh with your running numbers uses the "default" container in the mesh-table otherwise the running numbers WILL NOT WORK!

For example:

mesh-table
{
  default
  {
    mesh                                "mesh_body/arn.lm"
    auto-create                         1
  }
}


Additional Checks

Check all your X.tga alpha channels are correct for the albedo/diffuse and normal textures.

Check their corresponding X.texture.txt files don't have alpha=X.tga in them when they are not needed. Check they do have it when you are using transparency though!


Previous Page . . . Next Page

Return to CCG Index

Content Creator's Guide

Personal tools