Rail3D*

   

 

Building A Model With Strips And Skins Part2



1 Making the Skin Texture (continued from Building A Model With Strips And Skins Part1)

1.1 Adding Windows

Canvas, the program I use, was originally designed for print media, so it doesn’t support alpha channel export. With a different graphics package, there may well be simpler ways of preparing transparent textures I follow the convention in most of my models that regions which are going to be transparent or semi-transparent in the final texture should be black (rgb 0:0:0). I apply the exact degree of transparency I need in the post-processing of the exported bitmap.

In this case the windows have a fairly simple design — the main window opening has a thin black rubber surround, while the opening toplights are framed in shiny metal.

Windows added — I’ve hidden the drawing overlay in this screenshot to make it clearer what is in the window layer

It’s a good idea to use a horizontal guideline to keep the window baselines level.

To make the windows themselves, you just need a rounded rectangle with a black fill and a dark grey line. I set the corner radius of the rectangle to 80mm, which looks about right.

The toplight is another rectangle, with no fill and a thicker line with a “chrome” gradient. The upper corners are radiused to match the window rectangle. I make one “standard window” and group the two components, then copy it for all the side windows. The cab windows use the same rounded rectangles, suitably resized. Since I was making rounded rectangles, I added the cab door surround as well, although this belongs more logically in the details layer.

1.2 Doorways

The door openings are just black rectangles with the top corners radiused. These will be made fully transparent in the final texture.

1.3 Details

On the details layer, add things like:

  • Sliding-door rails
  • The windscreen wiper (just a few grey lines)
  • The Munich coat of arms (I found a suitable image somewhere on the web, modified it with a transparent background and then pasted it onto a shield with a chrome fill and a grey line.)
  • The cutout for the front coupler
  • Light clusters (gradient fills of various kinds are useful for these)
  • Destination indicator (note how a light-grey rectangle gives the effect of a flip-over indicator)
  • Door handles (the recess is simply a shape with a grey fill and “multiply” transparency)
  • Cab door grab-handles

1.4 Doors

I also set out the texture for a passenger door on the details layer, using a copy of the doorblank shape as a guide. The doors themselves are symmetrical, so we only need a texture for one side of one door (if we wanted, we could do a separate texture for the interior side of the door, but I don’t usually bother with that).

To finish off, just add a couple of bits and pieces — the bogie sideframe, the seat, etc.

2 Preparing the texture for export

The result of working with the template and layer stack is that we have three views of the car (old livery, new livery, and interior) on top of each other. We need to sort these out. This is the way I usually do this, for each of the three views:

  1. Switch on the visibility of the appropriate layers (e.g. for the old livery, we need livery, windows, detail and doorblanks to be visible)
  2. Switch on “Select across layers”
  3. Drag a selection rectangle around all the bits you need
  4. Use “Copy to layer” to make a copy of all the bits in the exp layer
  5. Switch “Select across layers” off again
  6. Make the exp layer active, select all the bits you just copied there, and Group them
  7. Now you can safely drag the copied parts to a blank area of your drawing where you are preparing the export texture, without affecting the original.

Arrange the various bits in a neat rectangle. You can always stretch them a bit to make them fit into the space — the size and even the aspect ratio of the individual bits is not that important (the smaller they are, the less detail will be visible in the final model, that’s all).

It’s important to make sure that the layout is identical for all the different livery versions, of course, otherwise the skinning won’t work properly!

Textures for both livery versions arranged ready to export

3 Exporting

The export step is simple — just use the render tool to draw a rectangle around the area you want to export. I usually add guidelines before doing this, to make sure that I get the same area if I have to repeat the export stage.

Render the area as a tga image. If you’re going to do some post-processing, it’s best to render in 24 bit colour, without antialiassing, and with a ridiculously high resolultion (e.g. 5000×2000 pixels), so that you don’t lose information unnecessarily during post-processing.

4 Post-processing

In the post-processing stage, we can add the finishing touches to the bitmap image. What we want to achieve, in particular, is:

  • transfer transparency information to the alpha-channel so that we can get “glass” effects for the windows
  • anti-alias the image so that we don’t get horrible jaggy edges as the model moves away from us
  • set the resolution to a sensible size for use in Rail3D

I normally do this in PaintShop Pro — I could just as well do it in Canvas (or Gimp), but I’d have to learn how first…

4.1 Alpha-channel

  • Open the tga image in psp
  • In the Masks menu, select New — From Image
  • Choose This Window and Any non-zero value
The black areas will become transparent (indicated in psp by a checked pattern)
  • In the Masks menu, select Edit. In this mode you can edit the transparency information in the mask without affecting the image itself.
At the moment, the mask contains only pure black (100% transparent) and pure white (opaque). We want to change the transparency of the external glazing to a smaller value, so that it is visible as glass. The glazing in the interior wall should be left 100% transparent.
  • Draw selection rectangles around all the outside window areas, leaving the doorways and the interior glazing unselected. (Use Shift+Drag to select multiple areas)
  • Use the colour replacer tool () to change the black parts of your selection to a lightish grey. You will see the windows get less transparent.
  • Look carefully at your image to see if there are any unwanted transparent areas — you may have used pure black in your image for things that shouldn’t be transparent, e.g. the text in the destination indicator. Correct these in the same way as the windows, using the colour replacer to change black to white in those areas of the mask.
  • In the Masks menu, select Save to Alpha Channel — this makes the mask part of your image.
  • Switch off Edit Mask to return to normal edit mode
  • It is a good idea to save the tga image at this stage. Save the file in the subdirectory where you are going to put your model (in my case /Rail3D/Stock/Europe/Trams/Germany)

4.2 Anti-aliassing

Now that you have separated the transparency information from the colour information, it is safe to apply anti-aliassing. The aim of this step is to remove sharp edges between areas of different colours. With most images it’s a good idea to have a nice, sharp image. The problem is that the image is a rectangular grid of pixels. When you are using it in a 3D setting, edges, especially rounded or diagonal edges, will appear jagged (“blocky”) when the resolution of the texture is reduced (the model is far from the camera). Blurring the colour transitions a little bit helps to disguise this effect.

I usually apply a Gaussian blur filter to the image to anti-alias it before resizing — an averaging filter would also have a similar effect.

4.3 Resizing

Resize the image to the size you want to use in Rail3D. A width of about 1024 pixels is usually adequate for a passenger vehicle — you might be able to get away with 512. Rail3D doesn’t insist that texture sizes are exact powers of 2, but it is recommended to use powers of 2 when you can. Save the tga file again.

Later on, you will have to repeat these post-processing stages for the textures with the textures for the other livery version(s).

4.4 Scaling copy

It is a bit tedious to read off the u,v coordinates from the texture if it is an odd size. What I usually do is make a temporary copy of the texture, resized to 1000×1000, and flipped in the vertical direction. Now I can read off the u,v, coordinates directly in psp, simply dividing the pixel values by 1000. I save this with a name like temp.bmp so that I don’t forget to delete it later on.


See Building A Model With Strips And Skins Part3 for the final stage — building the 3d mesh in Rail3D.

Mark Hodson August 12, 2005, at 08:27 am



import