Clearing Trees on Tracks in Open Rails

Beginning with Experimental version¬† x.3369, it’s possible to clear trees appearing on the tracks in Open Rails. Not every route has this issue, but you’ll know it when you see it — Trees appear too close to the rails, in between the rails, in tunnel openings — anywhere a tree has no business being. If you run the same route in MSTS, the offending trees are nowhere to be found. So what’s going on?

When a route is built in the MSTS Route Editor, it’s possible to create “forest regions” — simple boundaries that define an area for trees to be automatically populated. If the tracks fall too close to, or even inside of, the boundaries of a forest region, MSTS will automatically suppress the trees that would intrude on the tracks. Open Rails doesn’t use the same method to separate trees from the rails, so some routes will display trees intruding on the tracks.

Early attempts to apply an algorithm to find and suppress tree/track conflicts where a forest region intrudes on the tracks could remove the trees, but incurred a heavy impact on frame rates. A recent re-evaluation of the methods has finally resulted in a successful means to prune away errant trees without adversely impacting frame rates or causing any other problems with scenery objects.

There is no option setting (at least not currently) to turn the tree-culling feature on or off; it works automatically based on the “Include” feature of Open Rails.

First, add a folder named Openrails in the problem route’s folder.

Next, create a Unicode text file named <Route_Name>.trk where <Route_Name > is the same as the route’s original .TRK file. To get the name, you’ll find the original .TRK file in the path:¬† …\Train Simulator\ROUTES\<Route_Name>\<Route_Name>.trk

Edit the new (blank) file to add the following:

include ( ../<Route_Name>.trk )

        ORTSUserPreferenceForestClearDistance ( 2 )

Be sure to put a space between the two lines. (And remember to replace <Route_Name> with the correct name.) A blank line may also be required above the “include” statement.

You can edit the file with WordPad, Notepad, or your favorite text editor that will save the file as Unicode text, just like editing any other MSTS file. Remember to save as Unicode when you’re done.

Why add the Openrails folder with a second .TRK file? It’s because of how the MSTS Route Editor handles the .TRK file. If you edit the route in the MSTS Route Editor, it will re-write the .TRK file with only MSTS values — which will erase the special Open Rails statement. By making the second version of the file which only contains the “Include” statement plus the Open Rails additional statement, it’s ignored by MSTS but added to the values defined in the master .TRK file at runtime by Open Rails.

The value (2) in the statement is a good starting value. A smaller value will allow trees closer to the track centerline; a larger value will increase the clearance relative to the track centerline. Since this line has to be inserted in every route’s .TRK file where you need to remove stray trees, you can vary the value based on each route’s needs if necessary.

Note that this will probably remove 99% or better of vegetation intruding on the rails. There are some special circumstances where some shrubs may still poke through bridges, but that’s most likely due to another as-yet unresolved difference between MSTS and Open Rails that this improvement can’t address.

This is, of course, a fix within the Experimental release series. It doesn’t apply to v1.0 of Open Rails. Since it’s part of the Experimental builds, it may see further changes as time goes on.