TokisanGames/Terrain3D

Import multiple (tiled) heightmaps simultaneously

KMouratidis opened this issue · 3 comments

Description

Some software / databases export heightmap data as multiple files, typically following some naming conventions to map position, e.g.: <X>_<Y>_<pixel size> (2672_1227.xyz or 2672_1227_0.5m.tif or x0_y0), or maybe with start/stop boundaries <X start>_<X end>_<Y start>_<Y end> (4.315_4.456_5.515_5.715), etc.

It would be nice if there was a way to point to a directory and import multiple files with a regex or something like that.

You could write a script to do it in a few minutes. Open up importer.gd which is a very simple script that uses the C++ API. You should be able to figure it out from there using the basic GDScript API to look at directories and get filenames.

Glorious success!

image

Thanks! It took me a while until I figured out I had to resize my 341x341 images to 1024x1024. I guess because of #77 the calculated offsets all fell in the same tile and each image overwrote the previous.

Do you think this is relevant for others?

Importer.gd does not resize to 1024. The import functions take in any size, smaller or larger than 1024 and automatically pads or slices to regions.

However, if your exported images were all 341x341, then yes that would take some image blitting to get into the right dimensions.

Your height data is 8-bit and very blocky. If you can export from the source at 16-bit it will look much better. Otherwise you'll need to smooth it.

As for useful to others, no one has requested any such thing, or mentioned any programs that provide sliced height maps. I'm not sure about adding it to the importer yet. But you could copy the script here in this ticket for future reference.