Is there any way to import terrain from multiple heightmaps automatically?

The default heightmap importer from the built-in terrain editor creates decent enough looking terrain. But if you are importing your terrain in chunks it is tedious to do the following for every chunk:

  1. Select the heightmap.
  2. Select the colormap.
  3. Set the position of the chunk.
  4. Click generate.

My current plan is to use 20 chunks so there’s no way I can do this manually every time I want to see how my terrain looks ingame while I iterate on it.

I am wondering if there is any way I can automate the above process.
I see that there is a service called HeightmapImporterService. Maybe this is what the terrain importer uses on the backend but all the methods are only available to core scripts. Is it possible to run a script with core permissions?

I’ve also tried to look at the source code for the built-in plugin so I could take out what I need. But trying to insert the TerrainEditor.rbxm model located in Roblox\Versions\version-latest\BuiltInPlugins\ gives me a “The file is corrupted” error. I read somewhere that this is possibly an attempt by Roblox to hide the source code of their plugins.
image

Any ideas?

Pretty sure you can’t.

Make your own heightmap importing pipeline:

Save your heightmap as a raw greyscale bitmap using GIMP or w/e, open it in a text editor and copy/paste it into a ModuleScript between return [[ and ]]. That way you can get your data as a string in a Lua script in Studio. Then decode that string somehow. If 8 bit “color” depth is enough for your use case, you can just do it char by char. Otherwise you’ll have to figure out how to read the data in a non-char-aligned way. Finally use normal terrain editing API to generate terrain from the height map.