Zylann/godot_heightmap_plugin

hterrain_data.gd: Unknown heightmap format 12

TheConceptBoy opened this issue · 3 comments

I've ported my project to Godot 4 and hterrain seems to be complaining about terrain format.

image

Heightmaps used to have the Godot image format RH (12), now they are using RF (the height.res is a Godot Image saved as-is with ResourceLoader).

There is still code handling RH, however there are several spots missing this and probably needs a case for RH case

if im.get_format() == Image.FORMAT_RF:

In fact other things might break with RH, if you find some you can report them, but every new heightmap uses RF.

I dont think the plugin will currently convert to RF if you have an existing map in the old format, it will keep saving the data as-is.
However I think if you export the heightmap as 32-bit float greyscale EXR and re-import it, it will become RF.
Nevermind, looks like it won't work. So for now you may have to use a script:

var path := "terrain/height.res"
var im := load(path)
im.convert(Image.FORMAT_RF)
ResourceSaver.save(im, path)

I pushed a few things, notably this which should load your old heightmap as RF if the found format is RH. To make the conversion persist, you may do any edit and save your scene.

Roger. Will give this a try and if no, export and re-import the heightmap :)