mohsenph69 / Godot-MTerrain-plugin

A GDExtension plugin which give godot the ability to produce highly optimized Terrain for Open world games
MIT License
372 stars 19 forks source link

How to import 16k terrain? #7

Closed nickpolet closed 9 months ago

nickpolet commented 9 months ago

Hey @mohsenph69,

Been tinkering with the addon, and it's got some great tools.

I'm trying to assess the 16k x 16k capabilities of it, but am struggling to import the heightmap. Exported a (rather large) 16385k map from WorldMachine, but trying to import it using the MTerrain importer results in an "Image exceeds the texture limit of 16384" error.

The export from WorldMachine is 16384 + 1, which tips it over the limit in godot.

Have you imported a 16k heightmap before? Any tips? I could export it without the +1 dimension, but I know it's quite important to have the +1 for the terrain mesh. Any way of importing tiles from WorldMachine etc...?

Screenshot from 2023-10-02 13-03-17

mohsenph69 commented 9 months ago

Hi @nickpolet

So This plugin importer use image class in Godot to import heightmap data, And unfortunately image class has a limitation for image size

Even I am not satisfy with that yet and in future I should improve that

And yes I imported the image with this size, and it worked fine, (I made each region resolution 2049, making smaller regions resolution make more material, and making bigger one cause less gpu optimization, There is balance and maybe you find a better number)

But for now you can import a tiled version of your terrain into M Terrain plugin, If you work with world machine it has a option to export tiled height map, And M Terrain importer automatically should recognize the format of tiled heightmap from world machine (It has a naming convention like heightmap_X01_Y01.r16)

But one thing to note here is the resolution of each tile become the resolution of your region, and tiled heightmap should be in power of two not 2^n + 1 The plugin importer make automatically shared pixel at edge of terrain and then the final resolution will be in 2^n + 1

You also need to specify a temp folder to import tiled heightmap which you should remove later, If you watch this video:

https://www.youtube.com/watch?v=PcAkWClET4U&t=105s

at some part I import some tiled image

Handling terrain at this size is a little bit tricky, the main problem is the loading time, and I recommend to create your material, grass and everything else on a smaller test terrain, because for now you should reload the terrain to see the changes which done on your material

And at last is this photo is the terrain that you made? Looks good man, well done

nickpolet commented 9 months ago

Ah, good to know. Thanks for the response.

I didn't realise you could import tiled heightmaps/splatmaps, which is great. Trying to export 16k maps from WorldMachine requires absolutely massive amounts of RAM, but tiled is much lighter on that front.

As for the performance when editing a large terrain... yep looking to see how that goes.