Re-skinning for beginners (that's me)

Creating and Editing Rollingstock
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Altoona+BeachCreek wrote:Results:
(And I apologize for making you download everything, but the attachment process won't let me upload them directly. "It was not possible to determine the dimensions of the image.")
Attached images here are limtied to 800x600, which is why I rarely bother attaching images here. What I usually do is just upload them to imgur and then link them in. !*th_up*!
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Don't upload bitmaps or tga's to the web. The file size is huge. Save screenshots as a medium quality jpg. Those 4 meg images will come in at around 400 k if saved as jpg, which means the cache time is one tenth. (0!!0)

Also, the standard Windows image viewer wont open a tga, which means anyone who extracts those shots and then clicks on them will need to wait for GIMP to open them. Too slow.

PS: I've had quite a lot of experience with optimising images for display on the web (comes from doing interface coding). For simple images like shots of hex files, I'll often save them as png8 with a restricted palette. That gives a much lower file size if not many colours are being used.
Last edited by Gumboots on Tue Sep 10, 2013 6:18 pm, edited 1 time in total.
User avatar
Altoona+BeachCreek
Conductor
Posts: 211
Joined: Wed Jun 27, 2012 8:44 pm
Location: Altoona, PA-Former PRR Shops!

Re: Re-skinning for beginners (that's me) Unread post

Oh, jeez, sorry! I really should have just taken the five extra seconds to find a free image convertor and at least make them jpg. I'll do that now if I can and remove the colossal files.
"Train roll on, on down the line. Take me many miles from my home."
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Turns out the tga's were corrupted anyway. When opened in GIMP they were just blank. Don't know what happened there. Usually they are fine when they come from the game.

You can convert them in GIMP. Just open the shot then save it as jpg. Easy. !*th_up*!
User avatar
Altoona+BeachCreek
Conductor
Posts: 211
Joined: Wed Jun 27, 2012 8:44 pm
Location: Altoona, PA-Former PRR Shops!

Re: Re-skinning for beginners (that's me) Unread post

Well this is making no sense. I'm not doing anything at all with them except saving them and archiving them, where in the world could that go wrong?? Ufortunately, I did have to get off the laptop, so I'm going to delete those files. I.l check in in case you have anything to say, but I better feed my praying mantises...
"Train roll on, on down the line. Take me many miles from my home."
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Aha. Just tried it and found out that GIMP wont correctly handle RRT3 sceenshot tga's. It opens them as a blank transparent image. No good. Not sure why. PS opens them just fine.

GIMP will open other tga's, so it must be something specific to the RRT3 screenshot format. Inkscape and Irfanview are no good for this either. Photoshop is fine, but you that means you have to have PS.
User avatar
Altoona+BeachCreek
Conductor
Posts: 211
Joined: Wed Jun 27, 2012 8:44 pm
Location: Altoona, PA-Former PRR Shops!

Re: Re-skinning for beginners (that's me) Unread post

Actually, my friend might still have photoshop. Maybe he can transfer it to me somehow? It is my understanding it costs money, doesn't it? In that field, I can agree with stoker: I have a budget of precisely $0 , or at least for the moment. And you know, on rt3's simulator cousin, people actually do pay cash for realistic engine add ons...
"Train roll on, on down the line. Take me many miles from my home."
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Ok, I found a fix for you: Re: 24 bit TGA

The suggested solution works for me. After adding, initialising, then deleting the layer mask the screenshot displays as expected, and can be exported (not just saved) as a jpg.

Complete procedure for dealing with RRT3 screenshots in GIMP goes like this:

Open file (obviously). From top menu select "Layer -> Mask -> Add Layer Mask". In the pop-up options select "Transfer layer's alpha channel", then "Add".

Again, select "Layer", then "Mask -> Delete Layer Mask". That gives you a normal looking screenshot.

Then go "File -> Export -> Select file type by extension (near the bottom, a bit hard to find) -> choose JPEG image -> Export". You'll now get a pop-up. Choose 60 for the quality and leave the other options alone. Click "Export".

Voila, you now have a .jpg shot at somewhere around 150kb instead of 4 meg. (0!!0)
User avatar
Altoona+BeachCreek
Conductor
Posts: 211
Joined: Wed Jun 27, 2012 8:44 pm
Location: Altoona, PA-Former PRR Shops!

Re: Re-skinning for beginners (that's me) Unread post

That's great! Once I get back on I'll fix it.
"Train roll on, on down the line. Take me many miles from my home."
User avatar
Hawk
The Big Dawg
Posts: 6503
Joined: Fri Nov 10, 2006 10:28 am
Location: North Georgia - USA

Re: Re-skinning for beginners (that's me) Unread post

Wow! You guys sure make saving images a complicated process.
Just get Irfanview. It will open RT3 tga files just fine. Then you simply save them as jpg.
Hawk
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Tried it. Wouldn't work for me.
Gumboots wrote:GIMP will open other tga's, so it must be something specific to the RRT3 screenshot format.Inkscape and Irfanview are no good for this either. Photoshop is fine, but you that means you have to have PS.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Ok, found out how to get Irfanview to work. Black TGA images...

Of course, Hawk could have mentioned that. :-P

It works for screenshots. It isn't going to be any good for working on tga's for skins, because it wont show the image properly with alpha channel transparency enabled.
User avatar
Hawk
The Big Dawg
Posts: 6503
Joined: Fri Nov 10, 2006 10:28 am
Location: North Georgia - USA

Re: Re-skinning for beginners (that's me) Unread post

Gumboots wrote:Ok, found out how to get Irfanview to work. Black TGA images...

Of course, Hawk could have mentioned that. :-P
Oops! :oops:
You're right. I should have mentioned that.
Hawk
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Alllllllllllllllllllll righty then.

More stuff I have learned:

One thing about having the low-res gfx fix installed is that I can now see how bad the gfx on most of the locos really are. ^**lylgh

Bear in mind that I'm playing at 1600 res, so when zoomed in a medium-sized loco like a Mikado can be 1,000px or so long. If the A skin is only 512x512, or if it's 1024x1024 but with only about 2/3 of that available for the length of the loco body (like the default H10) things are not looking so good close up.

There are a couple of things that can be done about this. One thing people should be aware of is that if they want to use the PopTop reskinning tool, it will only give you a starting skin of 512x512 even though in many cases the actual default loco uses a 1024x1024 skin. IOW, that tool is effectively forcing you to use the B skin for your A skin. This means your res is going to be twice as bad.

It may be possible to make the PopTop tool use the 1024x1024 A skins, simply by replacing the current images in that folder with ones extracted from the default locos. I haven't tried doing this yet, but someone should. It may make things a bit easier for beginner/intermediate skinners.

-----------------------------------------------------

Next thing is that I ran some quick tests by expanding the default .dds A skin to the scale I often see while playing. This was to get an idea of which bits look worse, and where it might be possible to make things look better without increasing overall image size.

The idea here is that some bits wont really matter, and others will, so scale up the bits that matter to give them clearer resolution. The bits that don't matter so much might be able to be scaled down to save space.

Drivers and bogies are one obvious area to look at, but I also found that things like valve linkages and other fairly "minor" components are often the worst for looks because of the effect the binary alpha channel can have on edge detail (makes them all blocky) and because they're very prominent in the finished loco. OTOH, stuff like chassis rails and leaf springs often don't matter so much, because there's enough in front of them to make them ok at lower res.

So, if you're thinking about skinning, I'd suggest taking your A skin and scaling it up in your image editor it's about the size you want it to look good at in the game. This will give you a good idea of which areas are likely to need work to get a satisfying result.

Obviously, doing this stuff about rescaling of components will require remapping gfx triangles to different areas of the image, but as we've seen in this thread that's pretty easy, right? :mrgreen:

I am also going to test running custom A skins at 1536x1536 or 2048x2048, just to see if it's possible. I already know that game will accept A skins smaller than 1024, so it might (hopefully) accept larger ones too.

ETA: Tried this. It turns out that 1024 x1024 is the upper limit. A skins bigger than that wont show in the game, and the loco will fall back to the B skin. However, it seems you can use A skins of any size smaller than that (ie: 768 x 768 works).

-----------------------------------------------------

Since 1024x1024 is the upper limit, I think that for anyone who is after a good result it'll be pretty much essential to use seperate skins for loco and tender, rather than the combined image some use. Apart from anything else, the extra space will make it much easier to get much easier to get text showing correctly on both sides, since there will be enough space to use two separate sides in the skin.

I've been thinking about this for the updated Berkshire. The tender that comes with the default H10 is just a standard USRA 12,000 gallon job, judging by the look of it. By shortening the rear end of it and removing a pair of wheels from each truck, it would be easy to make it into a USRA 8,000 gallon tender (they only varied in length of water tank and number of wheels).

By adding 4 extra points and 8 extra gfx triangles (not difficult) it would be easy to turn the coal bunker into the extended-top-rolled-in variants that many railroads used. These extra bits could be blanked out in the skin to keep the original USRA look, or shown when you want the rolled-top look. For instance, the Berky I'm currently modelling was a B & A A1b, and they often used the 8,000 gallon version with the extended rolled-in top.

So, what I'm going to do is pull the tender bits out of the default H10 skin and make a new image that will do all of the above. That'll mean two USRA tender files (one for the long tender and one for the short) which can be used interchangably depending on preference. These can be uploaded as part of everybody's skinning kit, which should be handy. !*th_up*!

Obviously, this is going to involve remapping all the gfx triangles for the tender. Fortunately, compared to what has gone before in this odyssey, that is not particularly difficult or tedious. :-D

-----------------------------------------------------

Another thing I've learned is that in conceptual terms, none of this stuff is difficult if you have a basic grasp of three-dimensional geometry and the mathematics necessary to handle it. IOW, if you got through high school with reasonable maths grades, you should be fine on the concepts.

Having the right editing tools does make a huge difference though, simply because the format of the files you have to work with is so brain-frazzling for humans.

-----------------------------------------------------

The last thing I've learned is that if you want a good quality job, and if you're after more than basic colour changes, doing this right is a lot of work. That means you don't want to try it unless it's a loco or whatever you have real enthusiasm for. If you don't love the thing, you'll either do a half-assed job of it or you'll never finish it. Personally, I don't love the Berkshire. I'm only finishing it as a learning exercise, so I can use the knowledge I've gained for other things. It'll still be a bit half-assed, simply because it's based on a default PopTop polygon net that has insufficient resolution for today's standards, but it'll be as good as can be done on that basis.
Last edited by Gumboots on Mon Dec 30, 2013 3:37 pm, edited 3 times in total.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

I just had an idea about the infamous glow in the dark skin problem. PS and GIMP allow you to set any layer or selection to the alpha channel, or to cut and paste on the alpha channel. This opens up good scope for a trick which doesn't rely on selection thresholds or stuff like that. It goes like this:

...........

ETA: Scrap that. Had a better idea. See next posts. !*th_up*!
Last edited by Gumboots on Fri Dec 20, 2013 4:52 pm, edited 1 time in total.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

D'oh. *!*!*!

This is even easier than I thought. You don't need most of the rigmarole in the last post. All you need to do is make up your fancy new skin, with all your nifty bits over a transparent background, and save it all as a png-8 (or in png-8 sections if the palette restriction is an issue for you).

Once you have all the skin components in png-8 format, all that's required is to import them all, set their mode to RGB, and compile them all in the correct locations on the one image. Then, all you do is export that image as a .tga.

Voila! All done. Instant playable game skin with no semi-transparent pixels anywhere. ^**lylgh

It's that easy, and if you want to manually edit in a few windows or whatever that's easy too. Just manually edit the alpha channel n the .tga. No worries. (0!!0)
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

Hmm. Ok, it's not quite that simple, but I found a way to do it. ;-)

1/ Assume you are starting with an existing DDS A skin extracted from the default PopTop PK4.

2/ You need to get this into a format that can be easily digested by other image editors. I found this was a bit tricky. Photoshop would only open them as blank, fully transparent files. GIMP wouldn't even open them.

Irfanview will open them, but if you try to save in either PNG or TGA format Irfanview will make a mess of the result. What you have to do is select the PNG option in Irfanview save, then make sure you choose to use the PNGCrush options. This will allow you to save with transparency in 8 bit format. That's good, because it gives you a starting point that is only showing the visible bits, and without partially transparent pixels anywhere. !*th_up*!

3/ Ok, so open your new PNG-8 image in Photoshop or GIMP. You can now edit it quite happily.

I was using Photoshop for this test run, and I have the nVidia DDS Plugin. So, I took the PNG and put guides around the old driving wheels, then cut those out. Next, I got the PSD for my nifty new grunge Berkshire wheels, made that into one layer, then pasted that into the edited A skin PNG.

The wheels were too big to fit the default image mapping, so I scaled them down to fit. Normally, this would result in partially transparent pixels and glow in the dark wheels.

4/ So, now I save it as PNG-8 straight from Photoshop. Binary transparency, right?

5/ Open that new PNG in Photoshop and save it as DDS with the nVidia plug-in (use DXT3 setting).

That works. Pic attached. Nice new dark n grungy Berky wheels that do not glow in the dark! ::!**!
no_glow_new_wheels.jpg
no_glow_new_wheels.jpg (65.88 KiB) Viewed 6802 times
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

I've just tested this method with all tender skins from A (1024 x 1024) down to G (16 x 16). It works. All skins look good, and none of them glow in the dark at all.

This is good news, folks. Nobody has to put up with glow in the dark locomotives any more, and nobody who wants to make a good locomotive has to tediously edit alpha channels. This method seems to be completely effective and, even better, is very easy to do. ::!**!

All I did was take the latest version of the A skin PSD, save as 1024 x1024 PNG-8, then open that PNG-8 and save it as DDS. One A skin sorted. !*th_up*!

Then, I resized the PSD down to 512 x 512 and saved that as a PNG-8, then as DDS. One B skin sorted.

Then, to get best image quality on the reductions, I stepped backwards on the PSD resize (back to 1024) then resized straight down to 256 x 256. Saved as PNG-8, then as DDS. One C skin sorted.

Rinse and repeat, all the way down to G. Piece of cake. No glow anywhere. No tedious alpha channel editing. It rocks. Do it. You know you want to. (0!!0)
A_skin_right.jpg
A_skin_right.jpg (75.35 KiB) Viewed 6762 times
B_skin_right.jpg
B_skin_right.jpg (63.05 KiB) Viewed 6762 times
C_skin_right.jpg
C_skin_right.jpg (61.16 KiB) Viewed 6762 times
Small_skin_right.jpg
Small_skin_right.jpg (39.44 KiB) Viewed 6762 times
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Re-skinning for beginners (that's me) Unread post

I've been doing a bit more idle fiddling with this stuff. What follows is rather long, but sums up what I've been learning about making skins, and how the game handles them.

I happen to be using the free nVidia Photoshop plugin for DDS, just because I have an old version of Photoshop which I've had for years, and which still does everything I want it to do. I haven't yet tried messing with DDS files in GIMP, so can't give an opinion on that. However, I have just noticed (after actually looking through the options *!*!*! ) the nVidia plugin does give you the choice of forcing binary alpha. This makes perfect sense, since DDS is only used for game files AFAIK, and a lot of older games relied on binary alpha. After a quick test, setting the binary threshold to 0 seems to work well.

The problem is that it is limited in which files it will accept for processing. Trying to go straight from PSD to DDS, which would be ideal, doesn't work because the PSD has too many channels for the plugin to handle. That means an intermediate step (to another image format) is still necessary. The basic idea of using a temporary image format that will allow forcing binary alpha (transparency) is still a winner, IMO. You can use either png-8 or gif for forcing the transparency, since in terms of results they are indistinguishable.

However, PNG-8 and gif both use restricted palettes, which can cause banding or other problems with some images. I've found that the plugin will handle PNG-24 images without dramas, which allows an unrestricted palette, but the catch here is that the final DDS will have a restricted palette anyway, so I'm not sure there will ever be any advantage in using PNG-24 as the temporary step.

The one real catch with this method is that it forces binary alpha everywhere, meaning the bits of the train that you might want to glow in the dark (lights, windows, etc) wont do it. They'll just come out as solid colour. This isn't a huge deal, but it's a niggle and I've found a way around it. Turns out that once the plugin has saved a file as DDS, Photoshop will then quite happily edit it, even though it wont edit DDS files exported straight from the game's default folders. Go figure.

This means you can save a DDS skin and then open it in PS to play with the alpha channel, putting it to non-binary in the small areas where you want night glow. This is a bit of a fiddle, but far less work than trying to get rid of unwanted night glow everywhere else. Since the alpha channel in any image can be edited just like any grayscale image, you can just cut and paste any bits you want to change. So, to get a headlight glowing again all you need to do is copy the relevant part of the alpha channel from another file (like a default skin) or simply use a selection to put bounds around the area, then some shade of grey and a brush to add your own in the right spots. !*th_up*!

-------------------------------------------------------

Next thing I've been grumbling to myself about :mrgreen: is the game's rendering abilities. They suck. They totally suck things which nobody should have to suck, and which your mother may have warned you about if she could bring herself to mention them. However, we is stuck with what the game can do.

The quality of work in many (not all) of the default skins is actually pretty high, but when rendered in the game they look a lot worse than an inspection of the DDS would lead you to expect. Basically, colours get muddy and lines get blurred. I'm not sure there is anything that can be done about the colours getting muddy. I know DDS does use a restricted palette that loses some information compared to a normal RGBA image (good basic description of the problem here) and my guess is that the image you see when looking at a saved DDS does not have the same palette that the game uses on the fly to render the image. IOW, I think most of the information loss happens on rendering, not on saving. This means getting a skin to look good in the game is trickier than just getting it to look good in your image editor. Good ol' RT3. You can always trust it to make simple jobs more difficult for you. :-P

TGA dosn't have the same palette restrictions as DDS, but that doesn't necessarily mean the game will be capable of rendering it properly. I did notice that Itsa Timmy posted a screenshot of a double diesel which has one loco done as DDS and another as TGA. The TGA does seem brighter and sharper. When I get the time and inclination I'll do a side by side comparison using both DDS and TGA skins, and see if the TGA gives any noticeable improvement in quality. If it does, it may be worth using. If not, sticking with DDS would be better for performance.

The blurring of lines can only be dealt with in one way, and that's by increasing the resolution (scale) of parts that need to look better. Even small changes should have a noticeable effect. Resolution is dependent on pixel density, which varies as the square of the linear dimension. IOW, making a part 10% bigger on the skin will give a roughly 20% increase in detail. The current skin for the Berkshire project has sufficient clear space to give roughly 15% scale increase for a lot of major components, which in theory would mean getting one third better detail than default. Means a lot of gfx remapping, which is a PITA, but should make a better looking unit if anyone can bring themselves to do it.

-------------------------------------------------------

There's another thing or two I've found, but this is getting into .3dp and hex nastiness, so skip the following if you're only into skins.

I've thought of a way of cleaning up some of the coding to make it more readable (relatively speaking). It'll never be truly human-friendly but it can be improved a bit. The thing is that the IEEE 754 single precision floating point format used for coordinates is as nasty and tricky as the name makes it sound. The default game files often contain a jumble of letters and numbers that appear to make no sense. Part of this is down to the nature of the format. Very small rounding errors in the gfx app used to create the default files can lead to wildy different looking hex code for two points that actually share the same coordinate. This makes the file far more confusing than it needs to be, since it's easier to figure out which face is where if some coordinates are the same (like for the edge of the smokebox, all y axis coordinates should match).

If you are editing a default file, it helps if you rationalise the hex for the coordinates a bit. Here are two shots, showing the default hex and how you can change it to be slightly less headbutt-inducing.
Default_code.png
Default_code.png (45.2 KiB) Viewed 6671 times
Evened_up.png
Evened_up.png (43.39 KiB) Viewed 6671 times

Also, if something should be 0 but is coded as something-not-quite-zero, change it. A good example is from the TrackPoint.3dp for the default Duke locomotive. The intended value for it is 0 for all three axes (ie: in the middle of the track, halfway along the loco) but the default hex says 17 B7 51 37 00 00 00 00 17 B7 51 37. !*00*!

If you run 17 B7 51 37 through a base converter you'll see that it is 0.00001250 in normal decimal. That equates to a difference of roughly 0.0001250" for a full scale locomotive and track, which you'll never notice in the game but which makes the code more confusing. If it just says 00 00 00 00 00 00 00 00 00 00 00 00 it makes more sense when pigging around in the files.

Note that 00 00 00 00 is not the only way that 0 can be coded. 00 00 00 05 is still 0. So is 00 00 00 0F. In terms of hex these are all the same, but they're a PITA for humans. Take the easier option and make it just say 00 00 00 00. !*th_up*!

This the leads into the next box of tricks. Because some of the bytes in this format are less important than others, you can use this to make any custom code more digestible. Starting with the "evened up" code from the previous screenshot, here you can see the effect of going further and changing the first byte to 00. The base converter shows that the difference in positioning is only about 0.0001 of a unit, which scales to about 0.001" on a full sized loco. Being able to effectively skip one byte makes things less mind-boggling when you're looking at walls of bytes.
Cleaner_code_1.png
Cleaner_code_1.png (17.22 KiB) Viewed 6671 times
Ok, so how far can you take this? It depends on the values you need, but often it can be taken quite a bit further than you might think. Two more examples below. In these cases the difference from the original is 0.22" and 0.09" respectively at full scale. Even the worst one is only about 1/4" out, and the second one only about 1/10" out. Anyone who doesn't think this is close enough for many points in RT3 models is even more OCD than I am. :mrgreen:
Cleaner_code_2.png
Cleaner_code_2.png (17.04 KiB) Viewed 6671 times
Cleaner_code_3.png
Cleaner_code_3.png (16.93 KiB) Viewed 6671 times
My 2c is that these last two examples are far easier to deal with, in terms of boggling of our brains when editing files, than the default code. I can remember 4 random bits of gobbledegook much easier than I can remember 8. !*th_up*!
User avatar
Hawk
The Big Dawg
Posts: 6503
Joined: Fri Nov 10, 2006 10:28 am
Location: North Georgia - USA

Re: Re-skinning for beginners (that's me) Unread post

For whatever ir's worth, you can grab a copy of Photoshop CS2 for free at this link.

http://www.techspot.com/downloads/3689- ... p-cs2.html

This is not a pirated copy. This is a legitimate copy. Since it's an older version, Adobe decided to give it away.
You can get the plugin here, but it's probably the same one you're using.
Hawk
Post Reply