Gimp-Forum.net

Full Version: Railroad tracks and other parallel lines made easy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:

[attachment=8841]

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

[attachment=8842]

(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:

[attachment=8843]

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). 

[attachment=8844]
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).

[attachment=8846]

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:

[attachment=8847]

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

[attachment=8848]
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)

[attachment=8849]
Ofnuts-,

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.

[attachment=8868]