Since the very first version for Trainz, back in 2005, TransDEM has always supported a “Basemap” feature, generic texture carrier objects, to be filled automatically with images of large scale maps, track schemas or ortho-photography. They are called “UTM tiles” in TransDEM (and adhere to the UMT grid). Since TransDEM 1.2 (2006), these tiles are also placed automatically at the correct position in the route.
Such “Basemaps” are a bypass for the limitations of the Trainz ground textures, which cannot be as detailed as we may want them, not if we paint entire baseboards and the whole route module with map images or ortho-photos.
Like most other “Basemap” implementations, the carrier objects for TransDEM's variant have been prefabricated meshes, which are flat by nature. In hilly terrain, this is less than ideal, because they have to be adjusted to terrain elevation at the point where we currently work.
The textures are individual for each such UTM tile, but the carrier meshes are always the same. Although the original size of 1000 x 1000 m per tile has been complemented with smaller 500 x 500 m tiles in 2010, the smaller ones still have to raised and lowered wherever we are confronted with hill slopes.
It would be much easier for the route builder, if the UTM tiles not only show the high-res cartography or ortho-image but also follow the shape of the terrain. This means, of course, that not only the textures but also the meshes have to be fabricated individually, quite a bit of computation work.
A year or so ago Trainz user ModelerMJ started a project for such terra-formed Basemaps, his approach closely coupled to Google Earth and other Google services. ModelerMJ has now offered to develop a software tool for route builders, based on his earlier work.
Long term TransDEM users may have noticed that I have always been very reluctant to integrate specific Google or other internet service providers' API functionality into TransDEM. The two online services in TransDEM, WMS and Map Tiles, run on on the very basic level of the HTTP protocol, no account registration, no APIs, no cookies, no personal data at all. For the same reason, Google Earth usage is limited to local, offline transfer of simple JPEG images and placemark files.
This policy requires that terra-formed UTM tiles in TransDEM must not rely on Google but have to be created independently of any online service. Of course, the best source for shaping individual UTM tiles is the terrain we already have in our Trainz route.
And that is what I have tried this week. Here is the result, the first tera-formed UTM tile for the well-known Wupper valley at Muengsten:
At the moment, this is only a proof of concept, but I plan to integrate it as a new feature into the next version of TransDEM. It will be called “3D UTM tiles”. Conventional flat tiles will still be offered, then tagged “2D”. 3D and 2D will be compatible as much as possible, including both 1000 and 500 m sizes.
As said in the introduction, 3D tiles are computation intensive. For each tile, three additional steps have to be processed:
- Retrieve elevations from the Trainz ground file for the position and extent of the individual tile. In TransDEM is easiest way for this is to create small individual DEMs for each. Minimum coding effort here, because the classes already exist.
- Prepare the individual mesh data. The standard approach for third party programs handling Trainz asset geometry goes via the Trainz-specific clear text XML representation of a mesh. This step computes vertices, normals and texture coordinates in XML format, based on the small DEM. The mesh will have a complete 10 m raster. At the moment I don't think additional optimization to remove unnecessary vertices will be needed.
- The last step is to generate the actual Trainz mesh – the .im file – from the XML representatione. The importer is provided by N3V/Auran. Users will have to download it themselves, as it may not be redistributed. The idea, of course, is to call the exporter automatically within TransDEM.
If everything goes to plan, the only visual change for the TransDEM user – apart from longer computation – will be a 2D/3D UTM tile radio button in the export dialog.
Two more aspects:
- This spring, I added GeoPDF import functionality to TransDEM which relies on a piece of totally independent external software, the GDAL utilities. It appears that the concept to run GDAL can also be applied to run the Trainz XML Mesh Importer, launched as an individual process, but under supervision of TransDEM as its parent process.
- The three additional steps mentioned are computation-intensive. As I cannot do much about the workflow itself, I have some ideas for parallelization. The last few versions of TransDEM already run some algorithms in parallel and make use of all available CPU cores on the user's PC. The task here will be a bit different as I need more control over the worker threads but I think it's doable.
As always, I can't give any time estimation for it all to be implemented. As indicated above, it's laboratory stage at the moment, proof of concept, with a number of ideas for the final design, but little of the real work has begun.