Heightmap getting compressed?

Currently trying to apply a heightmap using “Draw material to render target” and then “Landscape import Heightmap from Render target” in an Editor Utility Widget.


The result ends up looking like the heightmap is 8bit rather than 16bit,

This is the texture being run through the Render Target. Couldnt find any answers to this online and I cant tell if Im doing something wrong or if there is some engine limitation Im not aware of.

Looking at the Render Target the created texture still looks like its 16bit, I also have an 8bit version of the same texture so I can tell the difference.

Any help is appreciated.:slight_smile:

The engine isn’t going to write 16bit.

In other words. The Draw material function will only ever write 8bit.
And changing it to do 16 is probably possible if you pull the source. but hellish?

1 Like

Thank you for the info, I thought it might be something along those lines. I have a different approach to try instead using this:

But it requires me to use something else to convert the heightmap into this array which is more complicated than I thought. Python seemed to be the simplest answer but I dont know python so I tried GPT but of course it creates imaginary functions that dont exist. So Im still stuck but atleast closer to a solution..

For anyone else with this issue I found a solution:

This python code works for converting a png to uint16 array which it then exports as a csv file that can be imported to unreal as a datatable which can then be read by the “Set Heightmap data” node in blueprint which comes from the TAPython plugin. This plugin also allows you to create landscapes from blueprint.

Since unreal converts imported pngs to uassets Im not sure if python can read them but using the code above you can get the path to the original source file on your disk, but keep in mind that if you move it on your disk it wont update the path in unreal unless you reimport the file. That path can then be sent to the python code to allow the png to be converted.

This all allows you to create landscapes and set their heightmap all in blueprint and without compression

Few sidenotes: Blueprint doesnt support uint16 varibles as standard so all the variables in my datatable struct have to be integers which take up alot more space. A 4k heightmap caused my datatable to become 1.6gb in size, might be slightly smaller now since I changed the code to have 16 entries per row instead of 8 to reduce the row amount. Compared to a 1024x1024 heightmap that had a datatable size of 32mb. Might be better to create one string per row and then separate the entries from blueprint?

Heres also a very helpful video about importing csv files https://youtu.be/8yhLltZ4FmI

Lastly I also saw a mention that it was possible to change the unreal renderer to be 16bit which may have fixed my original problem.


But I have not done any research on this since I found it after creating this new solution.