Creating and using Terrain Textures in RailWorks
Introduction
Inspired by a tutorial from Derek Siddle (RSDerek on the UKTS Forum and a member of the RailWorks Development Team) I decided that I would like to have a go at creating my own set of terrain textures.
The default textures are fine, but they have not been added to or changed significantly since the days of Rail Simulator, although there were a few minor changes made for RailWorks.
I am not going to describe here how to make your own terrain texture sets, as that is well covered in the tutorial by Derek which was last seen here -
http://the-art-of-rws.blogspot.com/2010 ... art-1.html
This is the first part of a seven part series with the next six parts following on in Derek’s blog. These tutorials are quite straightforward to follow using the free image manipulation software called GIMP or you can use another image processing program such as Photoshop or Paint Shop Pro. Following the tutorial and using mainly GIMP, I was able to create a set of about 70 base textures and from these base textures, further combinations of base textures and flora textures can be compiled to create a wide range of interesting ground effects.
I found GIMP quite easy to use first time I tried it and whilst it is limited in what it can do, I now use it in preference to Paint Shop Pro for most image manipulation, but anyone used to Photoshop or Paint Shop Pro or other such programs will be able to work out how to achieve the required effects without using GIMP. To obtain GIMP it is best to do a Google search to find the download page.
You will need a lot of patience if you want to create your own texture sets as the image manipulation can take some time and a lot of the work is repetitive, although there is nothing particularly difficult that you have to do. If you want to cut out the creation process, however, then you can skip that bit and go straight to the creation of your own Blueprint using the textures sets that I have created and which come with this tutorial download
This tutorial describes how to compile your own texture Blueprint, export it to RailWorks and add to it and amend it until you are happy with the results.
Basic Information
a) It is very difficult to add a new set of terrain textures to an existing route. It can be done but you would need to carefully set up a new Blueprint that includes default terrain textures (to ensure that any textures already painted remained unaffected) plus the new textures that you want to include. You would not be able to use the default procedural flora (for reasons I give later) so the default textures in the game may not look like they did before close up.
Unless you want to try and work all of that out yourself, the best way is to create a new texture Blueprint at the same time as you create a new route, and start the route from scratch with the new textures.
b) Your new route needs to have its own route template and you need to have your own developer folder. My tutorial on creating a route template gives a lot of background information on the folder structure and talks you though the creation of a route template and loading screen. This tutorial was last seen here -
http://www.uktrainsim.com/index2.php?fo ... tebuilding
It is much quicker to create the route template using RW Tools but you will not see the detailed entries in the Blueprint and thus miss invaluable experience on using Blueprints for asset creation. In particular you will need to make a manual entry to tell the program where to find your terrain textures as they will be in a different place to the default textures. I therefore suggest that unless you are familiar with the creation of route templates, you should use my tutorial or any others that take you through the process from scratch.
c) You will see from Derek’s tutorial that a set of texture tiles is usually made up of eight slightly different images of 256 pixels x 256 pixels each. These eight images have been made into Wang tiles that will tile together in such a way that the joins are disguised. Although it is practically impossible to avoid repetitive patterns in the tiles at that relatively small size, a good texture will show only a faint pattern. I have not done too badly with my textures in this respect and there are a few where the pattern is very difficult to see.
Some textures, such as tarmac, only need one tile that has been manipulated to tile with itself when laid together, so this is why some of my sets have only one image.
d) I have included .tga images of all tiles in my texture collection and also the corresponding .ace images that RailWorks needs for the Blueprint. You should not need to do any conversion yourself from .tga to .ace but the images are there if you need them.
e) I have prefixed all my images with ‘Acorn’ so that they are easily disiguisable from any other textures that may be made publically available so please leave them this way if you can. You are, however, free to change the names of any of my texture images if you wish, perhaps to match your route, but this would be a long process.
I have also placed all of the images in logical folders for easy identification so that when you are creating your Blueprint you can find the right images quickly. You could, of couse, use all of the textures if you wish but remember that they add considerably to the route file size.
f) RS.com (at the time of writing) have left image sets of default textures in .tga format in the Assets/Kuju/RailSimulator/Environment/Terrain folders. Normally you would only find the TgPcDx files in here but Derek Siddle has said that -
‘Users are free to use/modify/share the .tga files, you can also move them to your own provider/product. Only restriction is they are not used outside of RS or RWs.’
This means that you can create some .ace files of your own from these original image sets and create a texture in your own Blueprint from these images.
With my own textures, that gives you something like 120 textures to choose from when you are creating a terrain Blueprint. Although my own set does have a similar theme to that of the default set, you can pick and choose which ones suit you best.
Note that not all of the default images have .tga images available, but there are a few that have not been included in the default Blueprint so you have a few new ones to use from there as well.
g) In order to ensure that the same procedural flora does not appear in every season, three procedural flora textures sheets are required, one for summer (default season) one for spring and one for autumn. Winter is dealt with differently as there is no default flora showing on any winter textures so no specific flora texture sheet is required.
I have included the three necessary procedural flora texture sheets in .tga .ace. .xcf (GIMP) and psd (Photoshop) formats in the files that accompany this tutorial. The GIMP and Photoshop images have layers preserved for anyone who wants to have a go at amending or replacing any of my images. (I do not have Photoshop so I am not sure if that format saved from GIMP works but I hope so).
I will give more detail on using the procedural flora later in this tutorial.
Creating A New Terrain Blueprint
1 - Organising your source folder
On the assumption that your new terrain set is being compiled for a new route and your route template has already been created, it is likely that you have set the path for terrain details to Assets/Kuju/RailSimulator/Environment/Terrain/texturing.xml.
This is OK for the moment as you can change this path later quite easily. If you have not yet created your route template, then you can create your new terrain texture Blueprint first, export it to RailWorks and then create and export your route template afterwards with the correct path to your texture file included.
If you have not yet created your route template, and are unfamiliar with the way the source folder works, you need to set up your source folder like this -
a) In the RailWorks folder you will find the Source folder (if there is not one already in the RailWorks folder than you need to create one, just create a new folder and call it ‘Source’.
b) In this Source folder you need to create your Developer folder. This has to have a unique name that is associated only with you and can be your UKTS username, your real name or anything else you like as long as it is not the same as anyone else is using.
Keep the name concise and if you need to have more than one word then ensure that the words are joined_with_an_underscore.
For the purposes of this tutorial, I have chosen a Developer name of Terrainious and that is the name I have given to my Developer folder.
c) Inside this Developer folder you need a Product folder. For the purposes of this tutorial I have chosen TexRoute but you need to choose something of your own.
d) Inside the TexRoute folder you need to create another folder called Environment. (This name must be typed exactly as I have shown and must not be changed as it is one that RailWorks needs to recognise).
e) Inside the Environment folder you need to create another folder called Terrain. (Again, this name must be typed exactly as I have shown and must not be changed as RailWorks will be looking for this exact name).
f) Inside the Terrain folder you need to create seven new sub-folders with the names -
Concrete
Fields
Grass
Miscellaneous
Mud
Rock
Sand
It is in these last seven folders that the .ace files will be placed (for the Blueprint to use when exporting the Blueprint data to RailWorks) for converting to the TgPcDx image format that RailWorks requires.
You can get an idea of how the structure works by looking at the Kuju Assets folder. If you do this you will note that Kuju have different names for their folders in the Terrain folder but I have used the seven categories above as this mirrors the categories that you are given when choosing terrain textures to paint in the game. You can in fact use any number of folders with any names you like in the Terrain folder as the Blueprint scans all of those folders for the files it needs, but it seems logical to stick to the seven given categories.
2 - Filling up the Folders.
a) From the files I have provided in the Acorn Own Flora Texture Sheets folder, you need to find the following -
AcornFloraTextureSheet.ace
AcornFloraTextureSheet_Au.ace
AcornFloraTextureSheet_Sp.ace
Copy these files into your Terrain folder in the source folder along with the (currently empty) seven Terrain sub- folders.
b) I have placed all of my terrain tile sets into separate folders for ease of identification. You need to go though each of these folders and find the .ace files.
Textures with sets of Wang tiles will have eight .ace files with suffixes from A to H inclusive. You need to copy all eight .ace files and paste them into one of the seven Terrain sub-folders, Concrete, Fields, Grass, Miscellaneous, Mud, Rock and Sand as you think appropriate. Do not worry to much about how you categorise the files as the final categorisation is actually made in the Blueprint.
Textures with just one tile will have only one .ace file.
The files all go into the Terrain sub-folders together, there is no need to separate them within the sub-folders as they will naturally group themselves into sets of eight with the occasional single tile texture in-between.
You could copy of all my terrain texture .ace files if you wish, plus any you have made yourself and perhaps some default textures that you have converted into .ace files as well. This would, however, create a very large Environment folder so as you do not have to use all of them when creating the Blueprint, you really only need to use the ones that are more useful to you in your route.
You can add more textures later if you wish by adding the details into your terrain Blueprint and re exporting to RailWorks
3 - Creating a New Terrain Blueprint
Run RailWorks so that the opening screen is visible, this is the screen with the tabs for Settings, Packager, Package Manager, etc. Click on the Tools & Docs tab and then click on the Blueprints button. This will open up the Blueprint Editor.
In the left hand pane of the editor you will see the file structure of your own Source folder. If you click on the folders going down you will get something like this -
Click on your Developer folder to show the Product folder
Click on your Product folder to show the Environment folder
Click on your Environment folder to show your Terrain folder
Click on your Terrain folder to show your seven terrain sub-folders and the three flora texture files
Now right click on the Terrain folder and from the menu that appears choose ‘New Blueprint’
From the next menu that appears choose ‘Terrain texture blue print’
This will open up the blank Blueprint for you to work on.
If you now close the Blueprint Editor and then open it up again, navigate through your folders again to the Terrain folder and when you open that you should see the new Blueprint file, probably at the bottom of the list. It has a little black icon with an orange circle in the middle with a blue bar at the left and bottom. By clicking on this file you can open your Blueprint at any time you want to work on it.
By right clicking on the file name you can change the name of the Blueprint to perhaps better match the name of your route, but it is not essential to do this.
Note that it is best not to have the actual game running when you are editing and exporting Blueprints although the opening screen will have to be open to gain access to the Blueprint Editor.
4 - Working on the Blueprint : Part 1
The Blueprint is made up of two basic parts. The top part is called the Mix tex part where you keep adding a new section for each texture to be included in the Blueprint and the bottom part which holds some permanent information relating to base textures, automatic texturing at different heights and details on the base Rock Texture to use.
Derek’s tutorial gives some information on the settings to use in this bottom part and Adam Lucas (RSAdam on UKTS and a member of the RailWorks Development Team) gives more detailed information in the Phorum Peninsular blog last seen here -
http://rwsprojectplatform.blogspot.com/ ... uring.html
For the purposes of this tutorial I will use the same settings that are used in the default texture Blueprint.
a) The Sliders in the section marked ‘Distant terrain colour’ set the colour of the distant terrain. You can experiment with your own colours but for general purposes you can use -
Colour R - 0.254900
Colour G - 0.329400
Colour B - 0.000000
Alpha A - 0.00000 (Full Black)
The next set of values to define are -
Low ground texture index
Mid ground texture index
High ground texture index
Rock texture index
The numbers you put in these fields relate to the position of the texture you want to use from the top of the Blueprint. So if your default base texture is to be a certain type of grass and the first Mix tex section you have completed is for that grass, then you put ‘1’ in the Low, Mid and High ground texture fields.
If the Default Rock texture you want to use is 64th from the top in your Tex mix listing then you type ‘64’ into the Rock texture index field.
For ease of understanding, I suggest you keep a grass texture as the default texture everywhere at all heights and put this first in your Mix tex list and make the second texture in your Mix tex list a rock texture.
Now the first fields of your permanent data will be -
Low ground texture index = 1
Mid ground texture index = 1
High ground texture index = 1
Rock texture index = 2
I suggest you complete the next fields like this -
Low to mid height point = 5000
Low to mid threshold = 0
Mid to high height point = 4999
Mid to high threshold = 0
Rock gradient = 9
Rock threshold = 5
Shadow texture scale factor = 0.0005 (this will convert itself to a very long figure later but ignore this)
The very last field tells RailWorks where to find the procedural flora image so on the assumption that you are using my flora image sheets, then the entry to make here is (copy exactly) -
Environment\Terrain\AcornFloraTextureSheet
At this point it is a good idea to press the large grey save button at the top left of the Blueprint Editor screen.
5 - Working on the Blueprint : Part 2
You new Blueprint will have just one Mix tex section to start with which you open up by clicking on the + sign to the left of the words Mix tex. This opens up to reveal a set of fields with the heading Mix tex descriptor. To the left of these words are a - sign and a X. The - sign will collapse the fields out of view and the X will delete the whole section. Be warned that you do not get a second chance when you click on the X as this will instantly delete the information related to that particular Mix tex descriptor.
Under the X in each Mix tex descriptor section is a > and this is used to add a new Mix tex descriptor for a new texture. You can insert a new texture at any point in your listing like this.
We will start with the first Mix tex descriptor and then every new Mix tex descriptor for each new texture you want to include will be completed in a similar way.
a) Base texture name
I suggest you use my AcornGrass001 texture as your all over default texture.
When you were transferring the .ace files to the seven Terrain sub-folders you would have placed the eight AcornGrass001 files in the Grass sub-folder. From the Blueprint Editor explorer file tree, click on the Grass folder to reveal all of the files you have placed in there. You should find the full set of AcornGrass001 files with the suffixes of A to H. Right click on the AcornGrass001_A file and choose Copy Filename from the menu that appears.
Now click in the Base texture name field and press Control+V which will paste the file name into that field. Now delete the suffix and the .ace bit so you end up with -
Environment\Terrain\Grass\AcornGrass001
b) Seasonal texture names
Depending on the texture you are setting up, there may need to be different texture images for the differing seasons. With the base grass texture it will look pretty much the same in spring summer and autumn but winter will be different.
To set this up, navigate through the Blueprint folder tree to where you placed the AcornSnow001 files, right click on the AcornSnow001_A, copy the file and then paste to the field marked Base winter texture name. Delete the suffix and .ace and you end up with
Environment\Terrain\Grass\AcornSnow001
This is the general technique for setting up all main textures.
Generally you will not need to complete the Base summer texture name as the texture itself will be shown in summer by default but there may be instances where spring and autumn will use the base image but summer may be a very different image.
Most winter textures will be drawn from the general pool but it is possible to create different texture images for winter, or each season if you wish, and give each image the suffix _sp, _au, _wi as appropriate. This would give you 32 tiles per texture which is probably overdoing it a bit. You would not need to name other textures for the seasonal images then as the program would automatically find the correct winter variants of the main texture and use those.
You would not need to have any seasonal texture entries for Tarmac, for example, but you would need to complete the Base winter texture name with a path to a snow texture as tarmac would be covered by snow in winter. Note that all winter seasons are snowy... that is just the way it is in RailWorks. Also note that there is no procedural flora generated in the winter season on any texture.
c) Display name
This is the name that will appear in game in the list of terrain textures to use. With AcornGrass001 as an example, the display name could be anything you like but I suggest Acorn Grass 1 (No Flora).
d) Localised display name - English
This is the field where the English name of the texture is entered. I suggest you enter this exactly the same as the Display name. You need to complete this field in all cases otherwise the name will not show up in the selection list.
Complete other languages as you wish, but at least one of these fields needs to be completed.
e) Key
I do not know what this field is for as I cannot find any information on it. Just leave it empty.
f) Wang
This is where you tell the Blueprint if this texture set is a set of eight Wang tiles or not. If there are eight tiles then use the drop down menu to choose True. If there is only one tile, use the drop down menu to choose false.
Note that if you type the words true or false in this field it will not work. You have to use the drop down menu.
g) Flora index
If you open up the AcornFloraTextureSheet.tga in an image editing or viewing program, you will see the 16 procedural flora images arranged as 256 x 256 pixel images on the whole 1024 x 1024 pixel background. The index of each flora image runs from left to right down the image with the first flora being 0 and the last one 15.
In this field you enter the procedural flora image you want to associate with the this texture.
For the base Acorn Grass I (No Flora) I used the first image which has the index 0. For this particular texture I do not actually want procedural flora to show but even so, I have to specify an image index number.
Note that in Spring & Autumn the alternative Flora Texture Sheets are referenced to but the index position stays the same. For my Spring & Autumn flora texture sheets I mainly used the grass image at each of the 16 image index locations, which works adequately, but more experienced people might like to create more detailed flora images for their own seasonal flora texture sheets.
Note that although there is an up and down button to the right of this field, you can freely enter numbers directly here in the field itself.
h) Flora density
Enter a figure here between 0 and 1 to specify the density of the Flora with 1 being the max and 0 being none. For my base Acorn Grass 1 (No Flora), the entry here is 0.
Note that Acorn Grass 1 (Flora 1) will have identical entries to Acorn Grass 1 (No Flora) except in this field the number entered will be 1.
i) Category
Finally, from the drop down list choose a category as to where the texture can be picked from when in the game. It will probably be the same as the sub-folder where the .ace files are kept.
Again note that although there is an up and down button to the right of this field, you can freely enter numbers directly in the field here.
Now press the Save button again
6 - Exporting the Blueprint to RailWorks
You are now ready to export the Blueprint to RailWorks which is simply achieved by pressing the large grey ‘Export’ button. If all goes well there will be a bit of activity for a few seconds and you should then get a report in the very bottom section of the Blueprint Editor telling you that there has been a ‘Successful build’
If there has been a problem then this should be highlighted in that bottom report field.
There are many reasons for an unsuccessful build, and the report should indicate the likely cause, but it is usually down to incorrect path names or badly written names in the Blueprint fields. At this point I cannot help too much but I can only suggest that you carefully check back each section of this tutorial against your Blueprint, and you may find the error.
If the report was successful, then save the Blueprint and close the Blueprint editor.
If you have not created your new route template then you can do that now. If you are using my tutorial you will need to enter the path of your new terrain file instead of the default path to the Kuju file.
You can check out the path details to enter if you navigate through the RailWorks/Assets folder to your developer folder and product folder right down to your terrain Blueprint file which will be an .xml file located in your Terrain folder. The full path will be indicated in the top bar of the folder window.
If you have already created your route template and exported it to RailWorks using default terrain then you will need to go back to your route template Blueprint, enter the new path of the terrain Blueprint you want to use (your new one) and then export the template again. This will overwrite the previous information.
Assuming you have created a new route from your template, (any number of new routes can be created from your own route template) you can now run RailWorks and when you run that new route you should see the new base texture everywhere. There will be no procedural flora as this grass, which will be the only texture in the Blueprint at this stage, does not have any.
7 - Adding More Textures
The procedure is simple to add new textures to your terrain Blueprint, but it is very time consuming. All you do is open up the terrain Blueprint in the Blueprint Editor, click on the > sign under the X of the first Mix tex descriptor and enter up the fields the same way as you did for the first texture. Once you have completed the second texture, export the Blueprint again to see that it exports correctly and then go into RailWorks and see what it looks like.
It is a good idea to check that every new texture exports correctly and that it appears in the game correctly. It is also prudent to check every now and then that the seasonal textures and Flora show correctly.
Note that I created two versions of some of my textures, one without flora and one with. You can use the same base image several times in different Mix tex descriptor sections. For example, for my moor textures I have created five in my game, four of them using different flora and one without flora at all.
I have noticed that textures blend better when they do not have procedural flora associated with them so the texture without flora can be used in the area where a texture is coming up to join with another texture and this stops stray flora getting near the new texture and the new texture blends easily with the non-flora version of the other texture.
General Notes -
a) All of the texture files that accompany this tutorial can be used and distributed freely in any freeware route. They are not to be used in any commercial route or application.
b) Most of the source images I have used have come from free texture libraries, but a few have been from my own images and images made freely available by others. In some instances I have used a free texture that has already been tiled for immediate use but most of the source images have been worked on by me to create the final images or sets of images for use in RailWorks.
c) I have created the textures and this tutorial based on my own experiences but I cannot guarantee that you will get the same results so you use the textures and tutorial at your own risk. I cannot be held responsible for any damage to your own software or hardware that may result from using my textures or this tutorial.
d) If you have any queries then I will do my best to answer them.
You can e-mail me at - acorntrains(at)nwpotter.co.uk
or you can send me a private message on UKTrainsim under the user name of Acorncomputer.
Geoff Potter
31st August 2010