Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Railroad tracks and other parallel lines made easy
In general drawing parallel lines following arbitrary shapes is complicated, so making good looking railroad tracks in fantasy maps is difficult. But with the help of the ofn-gradient-along-path script this becomes quite easy.

Create a gradient which is one half the track and where the left side is transparency:


You  can test this gradient with the blend tool, using Shape: Bi-linear and Repeat: Truncate. This should produce two parallel lines:


(Note that the rail width is scaled with the track width)

Your tracks are defined  with a path which is the center of the track:


Then you add a layer and use ofn-gradient-along-path to render the gradient centered on the path, thus creating two curves that are parallel to the center path (the red line is just to show where the path is, it is not part of the final image). 

Given the center path, adding crossties is a piece of cake:

Create the crosstie image, that should be upright (and be slightly taller that the width you used when drawing the rails).


Then either make it a real brush (save as .gbr brushes folder) and select it, or just Edit > Copy it, and set the brush to Clipboard (Clipboard is always the first brush in the brushes list). Use the Brush tool options to:
  • set the brush
  • set the size (if you don't use the brush at its native size)
  • set the spacing (usually, 200-400%)
  • set the brush dynamics to Track direction
Then add a transparent layer, and Edit > Stroke path the center path using the Brush tool, with the Emulate brush dynamics option:


You then reorder layers, putting the rails above the ties:

You can use the ofn-brush-strokes-on-path script instead of Edit > Stroke path to draw the ties. Its main advantage over the plain Stroke path is that it will tweak the spacing setting so that the first and last crossties are exactly on the path ends (and if the path is closed that the ties around the closure are spaced like the rest)


Didn't see this thread until just now,...."well done"  IMO.

The "gradient along path"  appears to hold promise for many potential applications..

That's pretty neat.

Thanks for the tutorial, I managed it after a struggle to remember how to use the gradient editor and after being caught out by missing there's a new version of ofn-gradient-along-path that copes with transparency.  For some reason I missed the update in the Extending the gimp forum.


Forum Jump: