Rail3D*


 

Building A Model With Strips And Skins Part4



On this page…

  1. 1 The main body mesh
    1. 1.1 The front end
    2. 1.2 The Roof
  2. 2 Interior
  3. 3 Bogies
  4. 4 Doors

1 The main body mesh

The term “mesh” isn’t really correct for Rail3D — I use it here just to distinguish the 3-dimensional shape data in the model file from the 2-d texture.

The body component Munich_UBahn_A_body is a good place to start, as we will very quickly get something that starts looking like a train…

Looking at the drawings and photos, we can see that the body sides are basically flat from the bottom of the skirt (H=75) to the top of the doors (H=330). The front (driving) end curves inwards at the beginning of the cab side windows (L=79), but the rear end has sharp corners (L=1828). With this information, and the knowledge that the car is 290cm wide (i.e. the sides are at W= ±145), we can set out the first side as a strip:

 strip 0:0:0 *100
 −145/79/75 −1/0/0 
 −145/79/330 −1/0/0 
 −145/1828/75 −1/0/0 
 −145/1828/330 −1/0/0 
 endstrip

This is the side of the car pointing towards negative W, so the normals are all simply −1/0/0. (See More About Normals for more about this…)

The colour doesn’t matter, as we’re going to texture it in a minute. As it’s shiny painted metal (the Munich U-Bahn is notoriously spotless), we use the maximum gloss setting, *100.

Now all our work on the texture starts to come into its own. I uses psp to open the temporary (1000×1000) file we made earlier, and read off the position of the corners of the area we want:

The horizontal pixel position, divided by 1000, gives the u value; vertical pixel position, divided by 1000, gives the v value.

The back of the cab windows is at u=0.766, the back end of the body is at u=0.108, and the flat part of the side stretches vertically from v=0.503 to 0.844. Putting these into our strip, we get:

 strip 0:0:0 *100
 −145/79/75 −1/0/0 @0.766,0.503
 −145/79/330 −1/0/0 @0.766,0.844
 −145/1828/75 −1/0/0 @0.108,0.503
 −145/1828/330 −1/0/0 @0.108,0.844
 endstrip

Open the preview of Munich_UBahn_Aa and have a quick check in the preview to see if this looks right.

We have to use the preview of the parent component, because that’s where the skin is defined. If you look at the preview of the body component everything will be white, because the editor doesn’t know which texture to use. You could add the line

 DefaultSkin	”Munich_ubahn_a.tga”

to the body component to get around this, but we don’t really need it.

When you use the preview for a stock item, it’s a good idea to switch on the “dummy track section”, so that you can check that the model is in the right place relative to the rails. If it isn’t, you’ve probably either got it inside-out, or forgotten the Metric keyword.

To model the second side of the car, we can simply copy and paste the points in the same strip, changing the sign of the W coordinates in points and normals as we go:

 strip 0:0:0 *100
 −145/79/75 −1/0/0 @0.766,0.503
 −145/79/330 −1/0/0 @0.766,0.844
 −145/1828/75 −1/0/0 @0.108,0.503
 −145/1828/330 −1/0/0 @0.108,0.844

 145/1828/75 1/0/0 @0.108,0.503
 145/1828/330 1/0/0 @0.108,0.844
 145/79/75 1/0/0 @0.766,0.503
 145/79/330 1/0/0 @0.766,0.844
 endstrip

We can’t see both sides at once, because they’re pointing in opposite directions. We’ll make interior sides later.

The back end is supposed to have a window in it, and the shading doesn’t look quite right, so we need to add some extra points with correct normals and u,v coordinates:

 #sides and back of body

 strip 0:0:0 *100
 −145/79/75 −1/0/0 @0.766,0.503
 −145/79/330 −1/0/0 @0.766,0.844
 −145/1828/75 −1/0/0 @0.108,0.503
 −145/1828/330 −1/0/0 @0.108,0.844

 −145/1828/75 0/1/0 @0.0,0.503
 −145/1828/330 0/1/0 @0.0,0.844
 145/1828/75 0/1/0 @0.108,0.503
 145/1828/330 0/1/0 @0.108,0.844

 145/1828/75 1/0/0 @0.108,0.503
 145/1828/330 1/0/0 @0.108,0.844
 145/79/75 1/0/0 @0.766,0.503
 145/79/330 1/0/0 @0.766,0.844
 endstrip

Notice how having two vertices with different normals at the same point gives us lighting that corresponds to a sharp corner.

1.1 The front end

The front end is more complicated. In plan-view we have two quadrants connected by a straight part (W= =−80, L=30), but there’s an additional complication in that the upper half, from the bottom of the windscreen (H=188, v=0.655) upwards, is raked back slightly, while its top edge is raised to follow the edge of the roof.

Taking the lower part first:

I used my Strip Tool (See Other Software) to make a quarter-ellipse with its centre at W=−80, L=79). The radius in the W direction is (145 - 80 = 65) and in the L direction it is (79 - 30 = 49). Four points should be plenty. Ignore the labelling of the ellipticity boxes in the Strip Tool — I always have to use trial and error to work out which is which for a given orientation!

This gives us

 <. strip 0:0:0 
 <. −80/30/75  0/−49/0 @0.808,0.503
 <. −80/30/188  0/−49/0 @0.808,0.655
 <. −105/34/75  −25/−45/0 @0.798,0.503
 <. −105/34/188  −25/−45/0 @0.798,0.655
 <. −126/44/75  −46/−35/0 @0.787,0.503
 <. −126/44/188  −46/−35/0 @0.787,0.655
 <. −140/60/75  −60/−19/0 @0.776,0.503
 <. −140/60/188  −60/−19/0 @0.776,0.655
 <. −145/79/75  −65/0/0 @0.766,0.503
 <. −145/79/188  −65/0/0 @0.766,0.655

 <. endstrip

We can extend this across the flat region by adding another point at W=+80:

 <. strip 0:0:0 
 <. 80/30/75  0/−49/0 @0.869,0.503
 <. 80/30/188  0/−49/0 @0.869,0.655

 <. −80/30/75  0/−49/0 @0.808,0.503
 <. −80/30/188  0/−49/0 @0.808,0.655
 <. −105/34/75  −25/−45/0 @0.798,0.503
 <. −105/34/188  −25/−45/0 @0.798,0.655
 <. −126/44/75  −46/−35/0 @0.787,0.503
 <. −126/44/188  −46/−35/0 @0.787,0.655
 <. −140/60/75  −60/−19/0 @0.776,0.503
 <. −140/60/188  −60/−19/0 @0.776,0.655
 <. −145/79/75  −65/0/0 @0.766,0.503
 <. −145/79/188  −65/0/0 @0.766,0.655

 <. endstrip

Doing the same trick as before, we can create the curve of the other side by simply copying the points in reverse order, changing the sign of the W coordinate.

 <. strip 0:0:0
 <. 145/79/75  65/0/0 @0.766,0.503
 <. 145/79/188  65/0/0 @0.766,0.655 
 <. 140/60/75  60/−19/0 @0.776,0.503
 <. 140/60/188 60/−19/0 @0.776,0.655
 <. 126/44/75  46/−35/0 @0.787,0.503
 <. 126/44/188  46/−35/0 @0.787,0.655
 <. 105/34/75  25/−45/0 @0.798,0.503
 <. 105/34/188  25/−45/0 @0.798,0.655
 <. 80/30/75  0/49/0 @0.808,0.503
 <. 80/30/188  0/49/0 @0.808,0.655

 <. 80/30/75  0/−49/0 @0.869,0.503
 <. 80/30/188  0/−49/0 @0.869,0.655

 <. −80/30/75  0/−49/0 @0.808,0.503
 <. −80/30/188  0/−49/0 @0.808,0.655
 <. −105/34/75  −25/−45/0 @0.798,0.503
 <. −105/34/188  −25/−45/0 @0.798,0.655
 <. −126/44/75  −46/−35/0 @0.787,0.503
 <. −126/44/188  −46/−35/0 @0.787,0.655
 <. −140/60/75  −60/−19/0 @0.776,0.503
 <. −140/60/188  −60/−19/0 @0.776,0.655
 <. −145/79/75  −65/0/0 @0.766,0.503
 <. −145/79/188  −65/0/0 @0.766,0.655

 <. endstrip

The top half is made the same way, but with the inner points of the upper row shifted back a bit and raised to follow the edge of the roof. I used the roof coordinates (see below) to get the H values for the top edge.

 <. strip 0:0:0  *100
 <. 145/79/188  65/0/0 @0.766,0.655
 <. 145/79/330  65/0/0 @0.766,0.844
 <. 140/60/188  60/−19/0 @0.776,0.655
 <. 140/60/334  60/−19/0 @0.776,0.852
 <. 126/44/188  46/−35/0 @0.787,0.655
 <. 126/44/338  46/−35/0 @0.787,0.858
 <. 105/34/188  25/−45/0 @0.798,0.655
 <. 105/42/343  25/−45/0 @0.798,0.865
 <. 80/30/188  0/−49/0 @0.808,0.655
 <. 80/40/348  0/−49/0 @0.808,0.872
 <. 80/30/188  0/−49/0 @0.869,0.655
 <. 80/40/348  0/−49/0 @0.869,0.872
 <. −80/30/188  0/−49/0 @0.808,0.655
 <. −80/40/348  0/−49/0 @0.808,0.872
 <. −105/34/188  −25/−45/0 @0.798,0.655
 <. −105/42/343  −25/−45/0 @0.798,0.865
 <. −126/44/188  −46/−35/0 @0.787,0.655
 <. −126/44/338  −46/−35/0 @0.787,0.858
 <. −140/60/188  −60/−19/0 @0.776,0.655
 <. −140/60/334  −60/−19/0 @0.776,0.852
 <. −145/79/188  −65/0/0 @0.766,0.655
 <. −145/79/330  −65/0/0 @0.766,0.844
 <. endstrip

1.2 The Roof

The roof is made in the same way as the front end, but with ellipses around the L axis instead of the W axis. The radius in the W direction is still 65, so that we get points at the same W-values as the front end. We need the top of the roof to be at H=355, so the radius in the H direction is 25.

 <. strip 0:0:0 *90
 <. 145/79/330  65/0/0 @0.106,0.844
 <. 145/1828/330  65/0/0 @0.760,0.844
 <. 140/79/340  60/0/10 @0.106,0.870
 <. 140/1828/340  60/0/10 @0.760,0.870
 <. 126/79/348  46/0/18 @0.106,0.897
 <. 126/1828/348  46/0/18 @0.760,0.897
 <. 105/79/353  25/0/23 @0.106,0.924
 <. 105/1828/353  25/0/23 @0.760,0.924
 <. 80/79/355  0/0/25 @0.106,0.950
 <. 80/1828/355  0/0/25 @0.760,0.950
 <. −80/79/355  0/0/25 @0.106,0.950
 <. −80/1828/355  0/0/25 @0.760,0.950
 <. −105/79/353  −25/0/23 @0.106,0.924
 <. −105/1828/353  −25/0/23 @0.760,0.924
 <. −126/79/348  −46/0/18 @0.106,0.897
 <. −126/1828/348  −46/0/18 @0.760,0.897
 <. −140/79/340  −60/0/10 @0.106,0.870
 <. −140/1828/340  −60/0/10 @0.760,0.870
 <. −145/79/330  −65/0/0 @0.106,0.844
 <. −145/1828/330  −65/0/0 @0.760,0.844

 <. endstrip

We need to make a transom for the rear end, and a sloping section of roof to join the ellipse to the front end. These are easy enough to fill in using the values we already obtained for the roof and front end:

 #inner transom
 <. strip 0:0:0 *90
 <. 0/1828/330  0/1/0 @0.106,0.844
 <. −145/1828/330  0/1/0 @0.760,0.844
 <. 0/1828/330  0/1/0 @0.106,0.870
 <. −140/1828/340  0/1/0 @0.760,0.870
 <. 0/1828/330  0/1/0 @0.106,0.897
 <. −126/1828/348  0/1/0 @0.760,0.897
 <. 0/1828/330  0/1/0 @0.106,0.924
 <. −105/1828/353  0/1/0 @0.760,0.924
 <. 0/1828/330  0/1/0 @0.106,0.950
 <. −80/1828/355  0/1/0 @0.760,0.950
 <. −0/1828/330  0/1/0 @0.106,0.950
 <. 80/1828/355  0/1/0 @0.760,0.950
 <. −0/1828/330  0/1/0 @0.106,0.924
 <. 105/1828/353  0/1/0 @0.760,0.924
 <. −0/1828/330  0/1/0 @0.106,0.897
 <. 126/1828/348  0/1/0 @0.760,0.897
 <. −0/1828/330  0/1/0 @0.106,0.870
 <. 140/1828/340  0/1/0 @0.760,0.870
 <. −0/1828/330  0/1/0 @0.106,0.844
 <. 145/1828/330 0/1/0 @0.760,0.844
 <. endstrip

 #cab roof end


 <. strip 0:0:0 *90
 <. 145/79/330  65/0/0 @0.106,0.844
 <. 145/79/330  65/0/0 @0.106,0.844
 <. 140/60/332  60/−19/0 @0.156,0.870
 <. 140/79/340  60/0/10 @0.106,0.870
 <. 126/44/335  46/−35/0 @0.156,0.897
 <. 126/79/348  46/0/18 @0.106,0.897
 <. 105/42/338  25/−45/0 @0.156,0.924
 <. 105/79/353  25/0/23 @0.106,0.924
 <. 80/40/340  0/−49/0 @0.156,0.950
 <. 80/79/355  0/0/25 @0.106,0.950
 <. −80/40/340  0/−49/0 @0.156,0.950
 <. −80/79/355  0/0/25 @0.106,0.950
 <. −105/42/338  −25/−45/0 @0.156,0.924
 <. −105/79/353  −25/0/23 @0.106,0.924
 <. −126/44/335  −46/−35/0 @0.156,0.897
 <. −126/79/348  −46/0/18 @0.106,0.897
 <. −140/60/332  −60/−19/0 @0.156,0.870
 <. −140/79/340  −60/0/10 @0.106,0.870
 <. −145/79/330  −65/0/0 @0.106,0.844
 <. −145/79/330  −65/0/0 @0.106,0.844
 <. endstrip

2 Interior

Under Construction

3 Bogies

Under Construction

4 Doors

Under Construction

Mark Hodson August 13, 2005, at 03:34 pm



import