LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Welcome to SimCity 4 Devotion. Please login or sign up.

August 16, 2022, 09:26:34 PM

Login with username, password and session length


Creating Smooth Curve Rail Textures

Started by dedgren, October 10, 2008, 12:36:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Over at the RAM Team thread, we've been dealing with the issue of creating smooth rail curves.  The method that follows in this tutorial will allow relatively simple creation of textures like this for incorporation into the game using the usual techniques.

Now, what we'll do here assumes working knowledge of a reasonably featured graphics program.  As I have noted in the past, I continue to use Paint Shop Pro, adhering to the "go with what you know" theory of developing things.  PSP in its various iterations has a fairly standard set of features- so I will just refer to their use generically.  If you try to do this at home with "GraphicsMateXYZ19" and you can't find the corresponding feature, give me a yell- we'll figure it out.

To start, I created an empty 256x128 pixel raster format new document.  I then cut and pasted a 128x128 straight and 128x128 diagonal STR segment into it as follows.

Fig. 1

This gives me the fixed locations of where the track enters and leaves the gridsquares and the alignment of the track into the squares.

Next, I draw a vector circle with a line thickness of "1" and no fill so that the outer edge of the ties on the straight track section and the outer edge of the ties on the diagonal section are tangent to it.  In PSP, drawing a vector object automatically puts that object on a new vector layer- you'll want on if your program does not automatically create one.

Fig. 2

Now, the high-end vector graphics programs like Illustrator allow you, I believe, to conform objects to vector curves.  PSP does not, and that was where I thought I was up against the wall... until...

...until I remembered that you can conform a line of text to a vector curve in PSP.

What is a small "L" anyway if not a miniature railroad tie?

After some T&E, I found that a lowercase Arial 24pt "L" is just the right size.

Fig. 3

Using the "Fit text to curve" tool and typing a line of Ls produces this.  I made them blue so that they are easy to see.  Except for the spacing, they are perfect!  And, we can fix the spacing.  I've circled the "Kerning" input field in the text toolbar- note that the value in it is "25".  Changing it to "35" gives the proper spacing.  Now we just lay on that old L key...

...and, when we are around to match up with our diagonal track segment, we stop.

Fig. 4

Next, we'll select the raster layer we initially created and erase everything behind our newly laid blue ties...

Fig. 5

...then turn the ties black, as this is not SimVenus we are doing this for.

Fig. 6

Next, return to our vector layer and, after sampling the color of the existing track rails, draw two new vector circles with a line thickness of 1.5 and a transparent center using the same center coordinates as our first circle and aligning with the rails on each segment.

Fig. 7

After these are completed, created a new raster layer between the existing one and the vector layer.  Sample the ballast area on the first layer with the clone tool, then paint the sampled ballast onto the new raster layer.  Using the usual clone tool technique, expand this area out "under" the track...

Fig. 8

...until the entire ballasted area is filled in.

Fig. 9

We'll complete work on the ballast by (1) using the "Lighten/Darken" tool to darken the area between our new rails to match and to add the darker still oil stain line that the game has in the middle of the ties.  This leaves (2) the need to add the "shadow" along the side of the rails.

Fig. 10

We do that by returning to our vector layer and drawing two circles that are .5 pixels in edge thickness and have a transparent center.  These are then lined up with the existing shadows at each end.

Fig. 11

Now for some fine detailing.  I noticed that the tie ends down toward the transition to the original diagonal segment were't as large as I would have liked.  So, using PSP's "freehand" selection tool, I (1) copied an acceptable tie end area from the original raster layer and (2-5) pasted it as appropriate.

Fig. 12

Remember that we are working at many times final scale here, so what looks blocky as we are working will all but disappear in the final product.

Your work now looks like this- we're almost done.

Fig. 13

Returning on last time to the vector layer, sample the green border area along the track and using that color draw a circle 11 pixels in width and with a transparent center that line up with the existing borders.

Fig. 14

Repeat this for the other border.

Fig. 15

Now, except for some last glitch-fixing, you are about done.  Save your work to this point in your graphics program's format that preserves layer information just in case you need to return to something.  Then convert the vector layer to a raster layer and erase all of the parts of it that extend beyond the nw track area you created.  Then take a deep breath and merge all the layers.  Your work will now look like this- note that I have circled areas that will need touching up.

Fig. 16

Make these final corrections and here's what you have.

Fig. 17

Cool, eh?

D. Edgren

Please call me David...

Three Rivers Region- A collaborative development of the SC4 community
The 3RR Quick Finder [linkie]

I aten't dead.  —  R.I.P. Granny Weatherwax

Skype: davidredgren


Quote from: dedgren on October 10, 2008, 12:36:47 PM
Cool, eh?

What can I say? lllllllllllllllllll :) Very cool trick with the l's! :thumbsup:


Excuse me to post now, but this tutorial can be doing with The GIMP ???
Thanks to your answer :)
My BATs or here but it is in french ;)