The 'inverted heightmap' problem

Back in December 24, I raised the issue of heightmaps not generating Terrain meshs correctly, on Discord.

My understand is the issue is related at mapping heightmap textures (top to bottom, left to right) onto terrain meshes (bottom to top, left to right). This would also effect splatmap1 and splatmap2, I think.

@Tryibion make a short term fix, that since been rolled back.

What’s the current timetable for a permanent resolution?

How do other engines address this issue?

An help with this would be much appreciated.

I am a complete idiot and newbie with Flax and Game Dev but I think perhaps it’s how you lay out your question and info. Some pretty complex questions get answered, so just get an open mind to that maybe.

First this is naming. ‘inverted heightmap’ is really a symptom. What’s a better name ‘Image Terrain origin conflict’? Suggestions welcome.

Image are stored in files, starting at the top left. Each row is store from left to right, then repeating for each row DOWN the image.

missing image 2 - new user limit

Terrains are stored in structures started at the bottom left (at the feet of a viewer, standing at the origin and looking north). Each row is store from left to right, then repeating for each row UP (into the North/+Z) the terrain.

The symptom happen when Image data is naively copied (start to end) in the Terrain structure. Distance North (top) ends up at the viewers feet, and South (bottom) ends up in the distant North.

missing image 3 - new user limit

This screenshot shows what I mean. I created a flat terrain, then sculpted the origin corner (bottom left/south west) with a ‘hill’. I then exported the terrain to a heightmap. The ‘hill’ in the heightmap ended up in the origin corner (top left/north west). The ‘hill’ moved from south west in the terrain to north west in the human readable image. A problem.

How to fix?

1/ Fix the naive coping of data between images and terrains

2/ Add the ability for the user chose between naive and corrected coping (Unity does this).

missing image 4 - new user limit

Both solution have pro and cons.

Image 2

edit-actor-local-transform

Image 3

Image 4