This is an experiment of mine that has turned out much better than I expected. So I thought I'd share it.
I'm building a route where I needed some track shapes for DBTracks that do not exist. Like short tunnel sections to create a smooth grade change within tunnels and the ability to split a 2t tunnel into two 1t tunnels. The latter is not possible with the existing 1t tunnels because the walls end up overlapping.
So what does a programmer do? Yes! Code the problems away.
The result is a little collection of utilities that makes moving vertex points around quite easy to do in track shapes. I'm not adding/removing vertices or editing how they are connected. That's beyond the scope of this. But you can still do very interesting things with this both for straight and curved track shapes.
How this works is we define the centerline of the track like in the image below. When we have that and can calculate the closest distance from each vertex point to the centerline, identifying what part of the track a point belongs to becomes simple for both straight and curved track.
Trackcenters.png
Add in the following and now we can do really interesting things:
Creating 500r0_625d tunnels from 500r5d tunnels (code)
Here we simply move all points that are beyond 0_625d along the track curve to place them at 0_625d while keeping their offset to the track centerline.
Screenshot 2025-03-05 170957.png
Converting DB1z 1t track shapes into V4hs_RKL 1t slab track (code)
Here we move points of the trackbed, adjust the corresponding uv values, and change the textures to create RKL slab track.
Screenshot 2025-03-05 170537.png
Editing appearance of 5d switches (code)
This was to make the DBTracks switches appear more like the ones we have here in Denmark. The DB_WM1c part is moved below the trackbed and some textures have been changed. The new textures appear black because I didn't add them to the route yet.
Screenshot 2025-03-05 171410.png
Keep in mind that this is still very experimental. The code is only a couple of days old. But I thought maybe other people here will find it useful as well.
It is surprisingly easy to do stuff like this and automate it for a lot of track shapes.
I'm building a route where I needed some track shapes for DBTracks that do not exist. Like short tunnel sections to create a smooth grade change within tunnels and the ability to split a 2t tunnel into two 1t tunnels. The latter is not possible with the existing 1t tunnels because the walls end up overlapping.
So what does a programmer do? Yes! Code the problems away.
The result is a little collection of utilities that makes moving vertex points around quite easy to do in track shapes. I'm not adding/removing vertices or editing how they are connected. That's beyond the scope of this. But you can still do very interesting things with this both for straight and curved track shapes.
How this works is we define the centerline of the track like in the image below. When we have that and can calculate the closest distance from each vertex point to the centerline, identifying what part of the track a point belongs to becomes simple for both straight and curved track.
Trackcenters.png
Add in the following and now we can do really interesting things:
- Being able to check which prim_state (i.e. material) a point is associated with
- Being able to calculate new positions of points to change their distance to the centerline
- Being able to calculate new positions of points to change their distance from the start of the track
Creating 500r0_625d tunnels from 500r5d tunnels (code)
Here we simply move all points that are beyond 0_625d along the track curve to place them at 0_625d while keeping their offset to the track centerline.
Screenshot 2025-03-05 170957.png
Converting DB1z 1t track shapes into V4hs_RKL 1t slab track (code)
Here we move points of the trackbed, adjust the corresponding uv values, and change the textures to create RKL slab track.
Screenshot 2025-03-05 170537.png
Editing appearance of 5d switches (code)
This was to make the DBTracks switches appear more like the ones we have here in Denmark. The DB_WM1c part is moved below the trackbed and some textures have been changed. The new textures appear black because I didn't add them to the route yet.
Screenshot 2025-03-05 171410.png
Keep in mind that this is still very experimental. The code is only a couple of days old. But I thought maybe other people here will find it useful as well.
It is surprisingly easy to do stuff like this and automate it for a lot of track shapes.






Comment