Tutorial Gradient Plotting Mini-tutorial

Discussion in 'PC Editor Discussion' started by Tomas9970, Nov 15, 2023.

  1. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,036
    Likes Received:
    1,049
    Here's just a little tutorial on how to make smooth gradients. Not much effort put into it but I hope it still helps someone.

    For the demonstration, I will be using a grade on the route I'm making. As you can see, the route is going up around 1.7 meters upwards in 0.9 kilometers of track.

    Tutorial 1.png

    In order to calculate the percentage, we just need to divide the elevation difference in meters by the distance in kilometers. In this case it's 1.7/0.9, which is around 1.88 promile or 0.189% gradient. We will need this value later once we start aligning the track.

    Now for the editor part. Find the start and end of the grade and make new nodes in these places. Then set their elevation to match the height data plus the desired loft height. In my case, I kinda like 40cm loft so I will set the start and end heights to 454.0 and 455.7 meters respectively.

    Tutorial 2.png

    When that's done, go from the starting node and set the gradient for every node in between (don't touch the first one where you set the elevation!) to the value we calculated earlier. Notice how the nodes jump up or down to form a straight line. You can also do it on the very last one and verify that it only jumped by a few centimeters, which is just an unavoidable precision error.

    note: The nodes can be rotated backward so make sure you are setting the value closer to the camera when looking from the start direction.

    Tutorial 3.png

    Now set the last node's elevation back to the absolute value. This will put a bit of unevenness into the grade but it's far too small to notice without precise readouts and doing so will prevent small errors from amplifying across a larger route. With that, you can easily use that end node as a starting point for another grade and repeat the process as many times as you need to after that.
     
    Last edited: Nov 17, 2023
    • Helpful Helpful x 5
  2. Matin_TSP

    Matin_TSP Well-Known Member

    Joined:
    Oct 4, 2020
    Messages:
    2,063
    Likes Received:
    5,464
    Added your tutorial to my documentation spread sheet :)
     
  3. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,036
    Likes Received:
    1,049
    Sure. Thanks for the appreciation.
     
  4. RobertSchulz

    RobertSchulz Well-Known Member

    Joined:
    Oct 10, 2023
    Messages:
    1,863
    Likes Received:
    2,609
    Great tutorial!

    I would like to have your advice with an issue to lay the tracks with a gradient as smooth as possible, but it's a bit problematic in case because of the profile of my landscape.

    The problem is to lay my tracks over height data with many uneven hills and crests following over just a short distance of let's say 200 meters.

    Take a look at it here:
    (The yellow arrows mark the crests, and the blue ones the bumps or small hills)
    Screenshot (8901)2.png

    How would you solve this issue?

    Using your method I would need to place more nodes per distance and adjust the nodes for every single crest to hill/hill to crest distance.

    However, the track layering is a bit weird with so many small track pieces, but there is another issue connected.

    In the Editor, as far as I'm aware we don't have something like a "smooth the area surrounding the node elevation" parameter/option. When we drag a node too much up and following node isn't correctly aligned, we got a "upwards crack in the tracks".

    The following is an extreme example, just to illustrate what I mean:
    Screenshot (8903).png

    These "cracks" can be even out at large hills which provide a longer steadily continuing gradient (like you showd in the tutorial) but it's not easy to deal with them on just tiny hills. (The tracks are just too large to really adapt).

    So I could now go with the option to just create small portions of track and adjust all nodes accordingly, but since we can't smooth them lead to problems when the trains travel on them.

    Another probably way easier method, would be to just smooth the terrain and eliminate the hills and crests and just make it an even landscape.

    But since I would like to keep the landscape structure as it is with the hills and crests, this seems not like the appriate way to deal with the situation.

    What would you do?

    What do you mean with a "node can be rotated backwards"? I only can move a node vertically.


    The last one should be 455.7 instead of 454.7. It's in the second section.
     
    Last edited: Nov 17, 2023
  5. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,036
    Likes Received:
    1,049
    Thanks for the typo and now onto the questions.
    As you know, every node has Gradient values 1/2 and 2/2, where one value sets the grade that is facing towards you and the other one sets the grade facing in the other direction. It happens that the node directions aren't aligned even in a single section of track so if you adjust gradient 1/2 on one node because it's facing towards you, you might find that the next one is "backwards" and has gradient 2/2 facing in that direction so you have to set that instead of blindly copying values into 1/2 on every node.

    Just a little something I thought about.

    As for the weird grade that you posted, do you have a cabview of that? I would also want to see what it looks like when you plot it in QGIS using the Profile Tool (which is a plugin you can enable in the repository).
     
    • Helpful Helpful x 1
  6. Lulon

    Lulon Active Member

    Joined:
    Dec 3, 2017
    Messages:
    111
    Likes Received:
    120
    There is a smoothing tool. It's called vertical curves. I don't know by your post if you already know about it.
    It's a bit tricky to use, you would have to play around a bit. But it creates two new nodes around your selected node and in between will be the vertical curve. Once the vertical curve is placed, I think you cannot do anything else with that segment, e.g. make junctions.
    Threrefore it should be done only when everything else has been done.
    You *can* revert it, but I don't know how usable the reverted segment is gonna be.

    The way I deal with this is to first make sure the unevenness is also there in reallife and it's not just noise or a measurement error.
    If it's not there in reallife I would just average it and smooth the landscape.
    If it is there in reallife I would do it like you did and create vertical curves at the very end.

    For German routes, if you are really unsure, you can look up the gradients for I think every route.
    If you are interested:
    https://geovdbn.deutschebahn.com/isr
    It's tricky to use but the gradients are there.
    1. Click on Abfragen & Auswerten
    upload_2023-11-17_18-59-42.png
    2. Click on i in a circle
    upload_2023-11-17_19-0-2.png
    3. Click on your route
    4. Click on Infrastruktur
    upload_2023-11-17_19-1-4.png
    5. Find column Steigungsprofil
    upload_2023-11-17_19-1-41.png
    6. Figure out how to read the format. It's Gradient(Position in km);NextGradient(Position in km)
     
    • Helpful Helpful x 1
  7. RobertSchulz

    RobertSchulz Well-Known Member

    Joined:
    Oct 10, 2023
    Messages:
    1,863
    Likes Received:
    2,609
    Also corrected my typo, I meant of course "455.7 instead of 454.7".

    That's good to know. I didn't used the these parameter in the Detail Window very often, so I didn't know that. I prefer to adjust the node's forward and backward gradients by adjusting the node next to it in the Viewport.

    You gave a good hint with the cab ride and the Lidar data, if it really is like that in reality. I just checked one cab ride I have available for this section of my route. And it showed to be completely flat at that section. The section exactly starts where the cab ride starts, but the train drives from the opposite direction as in my screenshot:



    Strange. Seems to be an error the Lidar fetch or the data itself. I will smooth the terrain down and make it even. That's a new lesson to be learned: Don't always trust Lidar. I knew this already for some station rooftops which gave waves in the terrain but on plain terrain, I didn't think it would be possible that Lidar could be that wrong.

    But it actually makes me think about how to behave in such situation if you really have a landscape with so many hills and crests in sequence in the future? Because only for a short section I have this cab ride available and for the rest of the route, there is no available at all.

    Maybe just make it plain even where possible. Otherwise and you have a longer section and a gradient between start and end point, smooth the section a little bit before as much as possible and then sculpt the landscape to help laying the tracks relatively flat during the gradient increase.
     
    Last edited: Nov 17, 2023
  8. protonmw

    protonmw Active Member

    Joined:
    Mar 18, 2022
    Messages:
    179
    Likes Received:
    144
  9. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,036
    Likes Received:
    1,049
    In case of bad elevation data, I would just plot the track with an even grade (even if it ends up underground) and then flatten the ground under it with the "snap landscape to track" tool.

    If I really did find a section that goes up and down let's say every 100 meters even after a lot of fact-checking, I would probably plot it in QGIS to see elevation trends and filter out any actual noise, mark the grade changes, plot it with the sharp transitions and then use some very short vertical curves to make it drivable. Realistically speaking, I don't think such transitions exist anywhere except for some sub-40km/h branch lines.

    Also on the topic of inaccurate data, I decided to compare some decent LIDAR data (shown in blue) with SRTM (red). You can see that the difference is pretty massive.
    Comparison.png
     
  10. Mateiule

    Mateiule Well-Known Member

    Joined:
    Apr 27, 2021
    Messages:
    178
    Likes Received:
    255
    Where can I find this spreadsheet?
     
  11. Matin_TSP

    Matin_TSP Well-Known Member

    Joined:
    Oct 4, 2020
    Messages:
    2,063
    Likes Received:
    5,464
    It's a pinned thread in the PC Editor Discussions section
     

Share This Page