Using Paint.Net to reskin Trainz LocomotivesEdit
This document provides a workflow and description for using Paint.Net to reskin locomotives in Trainz. The description applies to undecorated locomotives, but it can be adapted to any asset. It is particularly suitable for undecorated locomotives because, once the project is set up, changes to colors or textures or logos are particularly easy, if this procedure is followed.
The description is targeted at TS12, but it should be applicable to versions back to 2009.
Paint .Net is a public-domain graphics manipulation program that is available here: http://www.getpaint.net/download.html
The main page is here: http://www.getpaint.net/index.html
Plugins are available that extend the functionality of Paint .Net. The procedure that is described here uses a plugin for the last example only – this example could be done in other ways that do not require plugins.
Paint .Net runs under Windows, but apparently can be made to run in an emulator on other platforms. This description refers to the Windows version.
The feature of Paint .Net that makes it particularly suitable for this procedure (apart from the fact that it is free!) is the use of layers. By using layers the original artwork in unchanged, as all changes are applied in their own layers. By keeping groups of changes together on one layer, further adjustments can be implemented by changing the painting on that layer, or by changing the layer properties. But, most importantly, by following the procedure described here (or something similar, if you want to experiment) the detail that is already part of these undecorated locomotives is preserved in the new skin – there is no need to re-add the detail of weathering or panels or rivets and joins. Of course, the facilities still exist to add additional detail or to alter any existing detail if you want.
There is a description of Paint .Net layers here: http://www.getpaint.net/doc/latest/WorkingWithLayers.html (all the Paint.Net documentation is online – you should be connected to the ‘net when using Paint.Net.) It’s worth reading if you haven’t previously used a graphics program that works with layers.
This description refers to version 3.5 of Paint .Net, but the functions used are fairly basic and have not changed much over the different versions.
This process also uses PEV’s mesh viewer available here: http://www.members.optusnet.com.au/villaump/pevsoft.htm
Other mesh viewers could be used, but I would not recommend RailYard as it takes too long to load. As demonstrated below, PEV’s Mesh Viewer makes it really easy to see the changes, almost as you make them.
The workflow. A simple recoloring example.Edit
1. Start by selecting your undecorated loco and creating a project folder. This example will use the GP38 (kuid:439337:100728) from msgsapper. I created a folder 'Working' in the TS12 main folder, and then a subfolder under the Working folder named ‘GP38 Project’. If you run into Windows security issues you may prefer to put the working folder into a different location that is not subject to Windows’ security restrictions.
2. In Content Creator, clone the original and then open the clone in Explorer (right-click, Edit, Edit In Explorer). The Explorer window will open.
3. Right click in the address bar of the Explorer window and select Copy Address As Text
4. Start PEV's Mesh Viewer utility. If necessary, select a file type of Trainz Mesh (*.im, *.pm). Select File / Open, paste the address just copied into the filename box and press Enter. The asset folder will open. Navigate to the location of the .im file (...\gp38 undecorated\gp38undec_body\gp38undec_body.im in this example) and select it. The loco will appear in the viewer.
5. Start Paint.Net. Click File / Open, paste the name just copied into the File name text box and press enter. The asset folder will appear. Find the main body TGA image and double click it (...\gp38 undecorated\gp38undec_body\gp38.tga in this example). It’s invariably the biggest file – sorting by size puts it at the top. It is also often called Main, or perhaps it has the same name as the loco. The image will open in the window.
6. Choose File / Save As. The Paint.Net Save format is PDN – this will be used for saving your reskinning project so you can come back to it at any time. Make sure PDN is selected as the Save as type. Navigate to the working directory and the project folder that was created in step 1, and save the PDN file in the project folder (..\Working\GP38 Project in this example).
7. Choose Layers / Add New Layer. If the Layers panel in Paint.Net is not open choose Window / Layers. Note that two layers are listed - Background and Layer 1. One of them will be highlighted. Click in the other layer to highlight that other layer. The highlighted layer is the one on which all selecting or drawing will occur. Note that the layers also have a check box. This controls whether or not the layers are visible. Layer 1 is currently all transparent, so when you create and show this new layer, it doesn't seem like anything has changed.
8. Click in Layer 1 (in the Layers window) to make it the active layer. Make sure it is also visible (the tick box is ticked). Then choose Layers / Layer Properties, and adjust the Blending Mode setting to Multiply. This setting ensures that detail (such as weathering) from the background layer is applied to the final image when the layers are merged for display. Adjust the Opacity to about two-thirds or 170 – the actual amount isn’t critical, as this will be adjusted again later to achieve the desired effect.
9. With layer 1 active and both layers visible you should see the original image. Layer 1 is entirely transparent by default. Use the Mesh Viewer image to relate the portions of the skin image to the full model. Note that most of the mapping is obvious, but some parts are quite mysterious. (Some assets will have the different portions of the image labelled with what they are, which helps a lot. If the labels do not exist then you could consider adding labelling to your project. The labelling does not have to be on the image - it can be in a separate layer which you turn on and off as needed).
10. This is the step where you see the benefits of working with layers. Make sure the toolbox is visible (Window / Tools) and check that layer 1 is the active layer. Select the rectangular selection tool (top left in the toolbar). Starting from a corner of a section of the loco that you want to change (e.g., a corner of the roof section) create a selection rectangle that covers that particular region.
11. Make sure the color selector window is visible (Window / Colors) and select a color.
12. Select the Fill tool from the toolbox (the pouring bucket). Left-click inside the selected rectangle. It will fill with the selected color. Note that the selection rectangle (and the color) might extend beyond the actual hood area – this doesn’t matter if this area is not used in the skinning, as in the example below. Also notice how the coloring has retained the shading of detail from the background image.
13. Select Layers / Properties. Adjust the opacity setting to see the effect. This could be referred to as saturation. But note that the detail in the background image is retained even when opacity is 255
14. Select a new color. With the Fill tool still selected, click anywhere within that colored patch. The color changes to the new color. By default, the fill tool fills only regions of the one color. This means that if you keep your colored regions separate then you can recolor any region simply by filling that region using the fill tool. Or, just select a region and hit Delete to remove all painting in that region. The skin image is laid out in separate rectangular regions, so this is easy to do. But if it’s not possible using one layer, just add another layer and work in that other layer.
15. Continue selecting and filling rectangular areas in layer 1 until you have colored the loco like you want. Remember that you can set up additional layers as required - this would be very useful where areas overlap, but you want to continue to handle them separately (probably not relevant for locos, but could apply to other asset types).
16. Choose File / Save As. With the default PDN file type, save your work in the project folder. This saves your project, so you can get back to where you were at any time in the future.
17. Choose File / Save As, change the type to TGA, navigate to the Edit folder (it should be part of the expanded list) and double click the existing TGA file to save over the top of it. Click OK to overwrite. This will save the image, which is what is used for the reskinning.
18. IMPORTANT: A message about merging or “flattening” the layers will appear. You must flatten the layers to save as TGA, so select Flatten. The file will be saved. Immediately the file has been saved, select Edit / Undo and the layers will be un-flattened. You must unflatten the layers immediately after saving as TGA in order to be able to continue to work on the layers separately. Also, click in the layer 1 item in the layers window, as the default working layer will have changed from Layer 1 to Background, and you will probably continue your work in Layer 1 (or any other layer you added) rather than the background. If you forget to unflatten the layers you will need to go back to the project folder and re-load the PDN, possibly losing some work.
NOTE: You will save as PDN (in the project folder) whenever you want to save your work to date. You will save as TGA (in the Edit folder) when you want to see your results. In practice, you will save as TGA (and review your work) much more often than you save the project as PDN.
19. Switch to Mesh Viewer. Select File and click the asset name. The image will be refreshed with the new skin. Review your work, and switch back to Paint.Net to make more changes or undo what you just did.
20. When finished, close Mesh Viewer, return to Content Manager and Commit the asset. You can recreate the thumbnail later on to make it match your new skin.
Adding a logoEdit
This process follows a similar procedure: Create a layer, place, size and color the logo, then adjust the layer properties so that it merges correctly with the other layers.
1. Find or create the logo. If it’s an image, copy it and then choose Edit / Paste in new layer. If it’s a file drag it onto the Image and select Add Layer when prompted
2. Enable the new layer and the background layer. With the new layer active, select the logo and resize it and move it until it appears correctly over the skin image. Note that in this case the layer Blending property is Normal, because I want the logo to appear as a solid color without the underlying detail showing through. Then follow the well-worn path –
File / Save as Save as type TGA Save Replace Yes Save Configuration OK Flatten Edit /Undo Mesh Viewer File / <filename>
This is essentially the same procedure as adding a logo, but in this example the lettering will retain the underlying detail, unlike the logo.
1. Create a new layer. Set the layer Blending property to Multiply (as for the original coloring layer).
2. Select font, color and size. Choose between anti-aliasing and non anti-aliasing to get the effect you want.
3. Type the text, select it and reposition it.
4. If you are applying the text to the side of the loco, you need to account for the image layout. Select the text and Copy it. Select Layer / Paste to new layer. The copied text will be pasted into a new layer and that layer becomes the active layer.
5. Select Layer / Flip vertical and Layer / Flip Horizontal. The text is now upside down. Move the text into position against the other side of the loco in the image. This procedure highlights the difference between Paint.Net and some other graphics programs. There is no option to invert or flip or rotate a selection. You must copy your object to a separate layer and work in that layer. At first this seems like extra effort, but it soon becomes a very natural way to work.
6. In the layers window, choose merge down. The layer created for the inverted lettering is now merged down into the layer ‘below’ it (the next one down in the layers window). If you watch carefully you will see that that lettering in the topmost window was overlaying the image with Normal blending, but when it was merged down into the layer below it took on that layer’s Multiply blending. For a layer that is created simply for the purpose of flipping or moving or coloring or whatever and is going to be merged down, you only need to have properties set that are relevant to that merge. In this case we wanted to paint a solid image into the merged layer, so Normal blending was suitable for the merge.
Adding a texture.Edit
Again, the process is essentially the same. Create a layer for the texture, add the image into that layer, position and size it, and set the layer properties for the effect you want. In this example I will apply a bump pattern effect to a portion of the roof.
1. Find your texture and copy it into a new layer, using either Paste in to New Layer (copied image) or Create New Layer (Drag and Drop a file).
2. With the new layer active, and the background layer visible, move, size and/or crop your texture to fit. Note that cropping to the background image is easy if you need a rectangular shape – just select an area and press Delete to remove it. In this case I wanted to retain the square shape of the pattern, so I kept it square as I resized and positioned on three edges, then cropped up to the fourth edge.
Adding an effectEdit
This example relies on a Paint.Net plugin. It is an example of how these effects can be used to create additions such as weathering. This effect can be easily added to the original image, but in this example I have taken the extra step of using a separate layer. This preserves the original image and makes it very easy to remove the effect, or to experiment with different effects because they can be discarded easily if they don’t work. But it does require one additional step that might not be obvious.
1. With the background image active, select the area where you want to apply weathering. This example will take a portion of the roof near the exhausts and the adjacent side panels. Note: this is not in the ‘top and sides’ portion in the upper part of the original image – it is a separate panel in the middle immediately below the ‘top and sides’. Use the Mesh Viewer to identify it.
2. Select Edit / Copy then Edit / Paste in to New Layer. A new layer will be created and the selected portion will be pasted. It will paste to the same location by default. If necessary, trim away any parts where you do not want the effect applied by using the selection rectangle and Delete.
3. Make sure the new layer is the active layer. Select Effect / Noise / Add noise (or whatever effect you want). Adjust the parameters as required – for this example I chose Intensity = 35, Color saturation = 0 and coverage = 100.
4. That’s all that’s required, but the point of this example is to show how the effects interact with each other. So, for the next bit to work, you need to add a color to the portion where the effect is.
5. Make sure the layer where the color was applied to the hood and cabin roof is visible (the tick mark) and active (highlighted), and that the effects layer is not visible.
6. Apply color to the whole roof region and to the extra region around the exhausts using the filled rectangle.
7. Make all the layers visible. Note how the roof section is not colored. The effects layer is overwriting the coloring.
8. In the layers window, click on the effects layer (the topmost one) to select it. Click the down arrow to move it down. Move it down until it is immediately above the original image. Notice how the color is now applied to this portion of the roof. The color layer has Blending set to Multiply, so it picks up the noise that we applied. But to do that it must be sequenced above the effects layer, otherwise the effects layer overwites the coloring. A similar result could have been achieved by setting properties in the effects layer (there are often several ways to do any particular task).
The order in which the layers are listed is important. The order is changed using the up arrow or down arrow in the layers window.
If the underlying image needs fixing, work in the background layer instead of layer 1. I have found that these images are often incorrect in tiny details, and that improving them using this process (save, and switch to mesh viewer to see your results) makes this sort of detail patching quite practical, even though the overall effect is slight. However, it is quite OK to copy any part of the original image to a new layer and work on that layer. That makes it much easier to und any particular change. As far as the final image is concerned, the number of layers used to make it up is quite irrelevant.
Identifying the area of the image that applies to a particular part of the loco body is difficult in some cases. At corners of the body it can be difficult to tell which image gets painted over which. It is possible to use a special layer which can be marked up with bright colours to help identify exactly what's what - remember that the layer can be simply deleted to remove all the markups, or you can exclude it from the final image just be ensuring it is not ticked when you save as TGA. The Render / Multi Color Gradient plugin is particularly useful for creating a pattern that helps to identify where a particular portion of the image paints to. Do one layer vertically and another horizontally and create separate renderings. The exact point can be identified from where the colours match.
Do not assume that a break in a surface appears as a break in the image – the break between cabin roof and hood in the image used here is an example. It is possible, with a lot of experimenting, to identify this point in the image. Drawing a ‘ruler’ – a line of crosshatching – can be a useful way to identify points within the image. Do it in a new layer, then just delete the layer when the point has been identified.