Home > Tutorials > TRS2004 3d Studio Max Rolling Stock Tutorial

3D Studio Max Rolling Stock Tutorial

In this tutorial you will learn how to create a box and texture it, add the required attachment points, export it and then create the config.txt file. The methods used to create the flatcar can be adapted to any Trainz rolling stock item.

Note. To complete this tutorial you will need to download the sample texture here.

3DStudio Max will be referred to as 3ds.

 

To complete these tutorials with the dimensions listed herein you will need the following setup
1. Open the "Units Setup.." dialog from the "Customize" menu and select the "System Units Setup" button. In the "System Units Scale", use the system unit scale of 1.0 units = 1m
2. In the "Units Setup set "Display Units Scale" to Metric Meters.

1. Create a box.

The first thing you need to do is create a box. At this point the size of the box does not matter.

 

Figure 1 Box tool

 

Figure 2 Box

 

2. Resize the box

Once you have created the box we need to resize it. You will need to select the box and then switch to the "Modify" panel.

Figure 3 Modify menu with the box selected

 

For the box you will need to enter the following dimensions

 

Parameter Box1(Main Body)
Length 12
Width 3
Height 0.2
Length Segments 1
Width Segments 1
Height Segments 1

 

Figure 4 Results after resizing

 

 

4. Converting to mesh (Optional)

The next step is to convert the body to an editable mesh object we do this by selecting the object and right clicking which then opens a context menu as shown in figure 5. Select the "Convert to Editable Mesh" entry. This is not required to complete the tutorial but if the box requires further editing or reshaping then you will need to convert the object to an editable mesh.

 

Figure 5 Converting to Editable Mesh

 

5. Relocating

Select the main body (Box1) and then select the move tool from the main tool button menu and type the following dimensions into the co-ordinate boxes. These boxes are located at the bottom of the 3d Studio Max window. You can also right click the "Move tool" and type them in the "Absolute World" section of the "Transform Type-in" window.

 
X
Y
Z
Box1
0
0
1

 

Figure 6 Move tool

 

Figure 7 Co-ordinate boxes

6.Applying Textures

We can now apply the textures to the main body. To do this we need to open the "Material Editor". Select the Material editor icon and the "Material Editor" will appear. Select the first globe and then expand the "Maps" menu. Find the entry "Diffuse Color" click on the corresponding "None" item. A new window will open called the "Material/Map Browser". You will see a list of items with a green parallelogram icon  Double click the "Bitmap" entry. This will open a "Select Bitmap Image File" dialog box. You will need to find and select the "Tutorial.tga" file. (You may need to change the file type to view tga files)

 

Figure 8 Material Editor Icon

 

Figure 9 Material Editor showing the globes at the top

 

When you have completed the texture loading select the first globe and drag it to the main body. In order for the textures to show up in the window select the blue and white cube in the "Material Editor".

 

7. Adding an "Unwrap UVW" modifier

Now that we have applied the texture to the main body we need to map the texture to the correct location. To do this we need to add an "Unwrap UVW" modifier to the main body. To add the modifier you need to select the main body and then go to the modify list in the modify menu. You may have to scroll down to find the "Unwrap UVW" modifier

 

Figure 10 Applying the Unwrap UVW modifier

 

Figure 11 Effect after adding the Unwrap UVW modifier

 

After you have applied the modifier expand the "Unwrap UVW" in the "Modifier List" and select the "Select Face" entry. Select the top of the main body and click on "Planar Map" and then click on "Edit" in the "Parameters" section of the "Unwrap UVW". A new window will appear called the "Edit UVW"

 

Figure 12 Select face

 

Figure 13 Face selected ready for mapping.

 

Now that we have a face selected and the "Edit UVW" window open you will see the screen in figure 14. If the texture in the background is wrong then you will need to change the map. To do this select the correct map from the drop down box on the top tool button bar.

 

Figure 14 Face map ready for aligning

 

To make it easier to align the textures to the main frame correctly we need to change the size of the map. To do this select "Show Options" in the bottom right of the Mapping window. Then under "Bitmap Options" select the "Use Custom Bitmap Size" option and change the width and height to the size of the file which in this case is 256 x 256. Make sure the "Use Custom Bitmap Size" checkbox is checked.

 

Figure 15 Using custom map size.

 

While the top face of the main body is still selected we need to normalize the map. To do this select the "Normal Mapping..." from the "Mapping" menu. When the "Normal Mapping" box appears select the "Top/Bottom Mapping" from the drop down box and click OK. This will allow us to detach the top face of the main body from the rest of the mapping.

 

Figure 16 Normal mapping from the Mapping menu

 

Figure 17 Normal mapping dialog box.

 

Figure 18 Freeform Mode.

 

Before proceeding any further we need to make sure the "Freeform Mode" icon is selected. Place the cursor over the selected map and move it to one side. Then select the rest of the mapping and move it to one side. You can also use the "Filter Selected Faces" icon to hide the other mapping but I prefer to leave all maps visible that way you don't apply the same texture area to two different mesh areas. Now we need to adjust the mapping to suit the texture. To resize the map place the cursor over the corner of the map and a triangle shaped cursor should appear. You can now drag the corner of the map down or up to the correct size. Place the texture as shown in figure 20. Continue selecting faces and moving and or resizing maps until you are happy with the locations and you have a result similar to figure 21. You will need to repeat this for each side.

NOTE The texture map outlines may be a different color in your version of 3ds

 

Figure 19 Filter selected faces.

 

Figure 20 Adjusting and relocating maps

 

Figure 21 Final mapping results.

 

8. Alternative mapping method

There is an alternative method that is available in 3ds and that is to select the entire main body and use the "Flatten Mapping" option from the menu. This will separate each face and allow you to resize and relocate them without having to use the "Normal Mapping" tool for each face. Depending on the type and shape of the object will decide the tool you use for the separation of maps. Trial and error is the only way to find the best method in some circumstances. Control-Z will undo any changes you have made that you are not happy with.

 

Figure 22 Alternative Flatten Mapping tool

 

9. Adding the attachment points

Now that the body of the flatcar is created and textured we need to add the attachment points for the bogeys and to show Trainz where each end of the flatcar is. When adding the attachment points it is recommended to switch to the "Top" view. To add a "Point" item in 3ds you need to go to the "Create" tab and then to the "Helpers" tab. You will need to add four attachment points. Name them and move them as follows

Name X Y Z
a.limback 0 6.5 0.89
a.bog1 0 4.5 0.45
a.bog0 0 -4.5 0.45
a.limfront 0 -6.5 0.89

The naming of these attachment points is critical and all of them must be included on the model.

 

Figure 23 Top view

 

Figure 24 Point menu item

 

Figure 25 Finished flatcar with attachment points

 

10. Where to export.

Before we export we need to create a new asset with CMP which is done by clicking on the "New" button or by selecting "File" "New" from the main menu. Once you have the "New Asset" window open scroll down to the "TrainCar" entry select it and then click on the "New" button. You will then be presented with the Content Creator Plus program with a TrainCar asset and the default config entries. The first thing we need to do is to give the asset a name. Type Tutorial Flatcar into the username tag in the Tag Space.

Once you have named the mesh we need to add a mesh-table container to the directory. To do this right click in the "Tree View" area and select "mesh-table" from the available containers at the top of the list.In the "Enter Name" window type in "default" and click OK. You should now be able to see the mesh-table entry in the tree view area. Now that we have an asset partially created in CCP and the config started we need to switch back to CMP and select the asset and then from the right context menu select "Edit" and then "Edit in Explorer" This will open a windows explorer window at the new assets path. Once the explorer window is open create a new folder called "Tutorial_body". This will be the location for the main mesh. Once you have created the folder then switch back to 3ds and make sure you have nothing selected and from the "File" menu select "Export". Navigate to the Tutorial_body folder you just created and type in the filename Tutorial_body.im. Before you hit the "Save" button change the file type in the drop down window to "Trainz Format(*im, *kin, *pm). Once you have this selected click on the "Save" button. 3ds will begin to convert and export the mesh into the Trainz .im format.

 

 

Figure 26 New toolbar button

 

Figure 27 Creating a new TrainCar asset

 

Figure 28 Default entries for a TrainCar asset (NOTE: Default installs of TRS2006 will have far more eras and regions.)

 

Figure 29 Adding a Mesh Table

 

Figure 30 Naming the mesh-table's first container

 

 

Figure 31 Default entry added

 

Figure 32 Export

 

11. Shadows.

Now that you have exported the main mesh into it's Tutorial_body folder we need to open the shadow file and export it in to a new folder called the Tutorial_shadow folder. Name the file Tutorial_shadow.im. A shadow file is a very low poly rendition of the general shape of the main mesh. It can be comprised of any number and shape of objects provided the overall shape of the rolling stock item is represented.

NOTE If you fail to add the shadow mesh, TRS2006 will report this in the error log. I strongly urge you to include a shadow mesh with your traincar.

12. Resource collector.

Now that you have the meshes exported you will notice that there are no textures included in the folder, just the main mesh and a few text files. The text files are what Trainz uses to find the textures. If you rename a texture.txt file, Trainz will be unable to find the mesh and your object will show up white.

To export the textures go to the "Utilities" tab and select the "More" button. In the window that appears select the "Resource Collector" it should automatically appear in one of the slots in the "Utilities" menu. Close the more "Utilities" window and in the "Output Path" navigate to the folder where you exported the mesh to. Once you have the path entered make sure the "Collect Bitmaps/Photometric Files" checkbox is selected and click on the "Begin" button. Repeat the procedure for the shadow file.

 

 

Figure 33 Resource Collector on the utilities menu

 

Figure 34 Resource collector settings

*Auran have stated that in future releases configs will not be directly edited.
For editing the text files I use a program called Ultra Edit. You can use Notepad or any other text editor.

Using CCP

13. Adding containers

Switch back to CCP from 3ds and in the tree view ensure the "default" entry of the "mesh-table" is selected. In the "Tag Space" click on the file selection button and use the "Load Mesh" file explorer to navigate to the folder containing the mesh. Select the mesh and click on OK. The path to the mesh should now be showing up in the mesh tag. While we have the default container selected right click in the tree view and add the following tags.

auto-create

ensure the check box is selected which activates that entry. If you have added a shadow mesh then you can also add another mesh to the mesh-table container. In this case name the container "shadow". Once added use the file navigation button and explorer to select the shadow mesh. No other tags are needed for the shadow mesh so we can move on to the next container.

In the file tree view right click and add the following tags.

company
enginespec
light
description

Also add the following containers.

thumbnails
bogeys

when adding the bogeys container you will be asked for a name for the container. Type in a meaningful name. In this case I have used the following;

front


Once the tags and containers have been added then enter the following values for each tag

Tag name Description and recomended value
kuid This is an uneditable entry and cannot be changed.
trainz-build This is an uneditable entry and cannot be changed.
category-class

Select the required class from the drop down box. In this case we need to select
XFM - General Service

category-region

Select the required regions by clicking in the checkbox next to each item. You can add as many regions as you like. In this case select the following;
CA; US

category-era

Select the required era's by clicking in the checkbox next to each item. You can add as many era as you need. In this case select the following;
1970s; 1980s; 1990s; 2000s

username

Type in a sutiable name for the asset. In this case I have used the following;
Tutorial Flatcar

kind This tells Trainz that the kind is a Traincar and not a scenery or track item and is an un-editable entry and cannot be changed
engine This tells Trainz that the item is a rolling stock item. Ensure the check box is de-selected.
mass This is the mass of the flatcar in kgs. In this case I have used the following value
25000
company

This is a company name for the item. In this case I have used the following value;
Tutorial

enginespec

This is the engines specification file. This is a required entry and in this case references a default engine spec for the SD40-2. Unfortunately the KUID browser is unable to differentiate engine specs from other assets and will display all installed assets. To trim the list down in the top text field type SD40 and wait a few seconds and the list should be reduced to a much smaller selection. You will notice here we are presented with another short coming of the KUID browser. There are three entries all named SD40-2 or similar. The top entry is the correct one. The only way to find out the kind for each entrie is to select it and then click on the "C" button which will return you to CMP. Right click on the asset and select "Edit in Explorer" then open the config.txt file and see what the "kind" tags value is. You could also use CCP to do the same thing however opening more than one instance of CCP may not work correctly. Eventually you will have the following entry for this tag
default_wagon

light Sets lighting to be used for object to be ambient or directional. If the checkbox is selected then the lighting is set to directional light which is affected by the position of the sun.

description



This is a description about the flat car. It can be brief or very detailed. I have used the following text for this tag
Tutorial on how to create a flat car

 

 

Figure 35 Additional tags with their default values

 

Figure 36 KUID browser using search feature

 

Now that we have all the standard tags added for the flat car we can customize the remaining two containers. Select the front sub-container of the bogey container and use the file navigation button and explorer to select the following value

36inch 2 Axle Truck

You may need to download it if you don't already have it.
Only select the reversed checkbox if you want the bogey animation to run in reverse.
For the thumbnails container we need to create a new folder called Tutorial_images and place the consist images in the folder. The art_512 image is no longer supported in TRS2006 so it can be deleted. (For the creation of these images see one of these tutorials Photoshop, Paint Shop Pro)
Now we need to point the file navigation button and explorer of the first image to the tutorial_art_icon.tga in the Tutorial_images folder. Once complete type 128 into the width text box and 24 into the height textbox.

Final step

 

 

 

Using a text file editor

14. Config entries

In the following table the required entries for the flat car and a brief description are shown. There are many more possibilities for TRS2004 than what is shown here.

Create a new text document from within your selected text editor and enter the following information.

Config.txt entry Uneditable entries in red Description
kuid <KUID:86105:15000> This is the kuid number. The "86105" should have been already replaced with your user number and the 15000 should also have a default entry. Do not change this number in any way as CMP will not recognize the changes even though you are editing with a text editor.
trainz-build 2.5 This tells the download station which version of Trainz the item is for.
category-class "XFM" This will allow the content to be sorted by the category class. XFM is a general duty flat car.
category-region-0 "CA;US" This is the region the flat car was used in. If there is more than one country required then you can add category-region-1 on the next line.
category-era-0 "1970s;1980s;1990s;2000s" This is the years that the item is used in. As with the region category you can have more than one.
username Tutorial Flatcar This is the name of the flatcar.
kind traincar This tells Trainz that the kind is a Traincar and not a scenery or track item.
engine 0 This tells Trainz that the item is a rolling stock item.
mass 25000 This is the mass of the flat car in kgs
company Tutorial This is a company name for the item.
enginespec <KUID:-1:42004231> This is the engine spec file. This file is included with Trainz and it is the engine spec file for a GP38-2
light 1  
description "Tutorial on how to create a flatcar " This is a description about the flatcar. It can be brief or very detailed.

mesh-table {
  default {
    mesh Tutorial_body/Tutorial_body.im
    auto-create 1
  }
  shadow {
    mesh Tutorial_shadow/Tutorial_shadow.im
  }
}

This is the mesh table. In this table you can reference items such as animation and other attachments. Animated items can also be controlled via the use of a script.

This is also where you add coronas and set up the night mode mesh etc.

bogeys {
  front {
    reversed 0
    bogey <kuid:86105:50003>
  }
}
This block specifies the trucks or bogeys to be used on the flatcar. If reversed was set to 1 then the animation would be played in reverse.
thumbnails {
  0 {
    image "tutorial_images/Tutorial_art_icon.tga"
    width 128
    height 64
  }
}
This block is to specify where to find the icon for surveyor. You can also use it to specify an image for use in CMP.

Once you have the text entered save the file to the root directory of the flatcar. Name the file config.txt

NOTE Do not copy and paste from this tutorial.

 

15. Viewing in Trainz

Save and close the file and start Trainz up using CMP ensuring you "Commit" the changes to the asset first and then go to surveyor.. The rolling stock should be listed as Tutorial Flatcar. Add the flatcar to a suitable track location and switch to driver.

 

 

 

 

 

 

Was this tutorial helpful? Not enough or too much detail? Points not explained properly? Suggest any improvements? Please use the Tutorial Enquiry Form

 

 

Trainz and Trainz Railroad Simulator are trademarks of Auran

Best viewed at 1024 x 768 or higher

Pages best viewed with Cooper and Cooper Black font installed.

Copyright © 2007 P. Campbell. All rights reserved. Revised: July 23, 2007