Getting a heightmap of a terrain (very accurately)

Hi,

I’ve made a terrain in the latest version of udk with the following settings:
Section size: 255x255
Sections per size: 2x2 sections
Number of components: 16x16
Overall resolution: 8161x8161
Total Components: 256

I would want to get the heightmap or all of the vertices of the terrain and I can’t find the way. I’ve searched the web and apparently there was a format before called .raw. Now it’s PNG and all it gives you is very innacurate data. With the above listed settings I would get a map that is 20000 by 20000 units in 8k squared picture and with a height by 20000 that has to be converted into the color for the heightmap, which can only be from 0 to 256. And, actually, for the positive side it only gets from 127-255. So there are only 128 values to represent 20000 units. Very innacurate.

The only solution I’ve come up with is this: have a object in the sky that moves on the X, Z axis, fires a ray on the ground, and sees the Y of that point. For every movement on the X,Z axis by 20cm, it would print out the Y for that bit. Maybe into a file.

Image to kind of get the idea: Screenshot by Lightshot

This is really messy though and I’m wondering if there are any kind of methods that I can call on the terrain to get this stuff. I think that if I would be able to get the vertices of the terrain, than maybe I would be able to make up the squares and kind of process it afterwards similar to before: fire rays from above on the ground and see where it hits.

Just to get the idea why I need this: I am implementing my own server and I have to move the champion wherever he wants. Therefore, I have to aknowledge that he might be moving on a hill so I have to make sure he doesn’t speed up like crazy and the rule of Pythagoras’ theorem is taken into consideration.

Any input would be greatly appreciated !

I have not done any heightmap work in Unreal (yet), but from my work from previous engine, the preferred heightmap file is raw16 which gives range of 0-65535. And the range is not split into half, positive and negative, instead the range is from minimum to maximum world unit. Minimum can be anything as long as it is minimum point in the terrain and so does maximum. So if you have a terrain with minimum height 5m and maximum 200m, the resolution is quite fine (1 unit = (200-5)/65536 = 0.003m ).

I think the solution for the rest of your post is to raycast downward a few points wherever the ‘champion’ is and therefore, you can easily deduce where the champion is - flat or hilly terrain. Again, I am not sure whether the solution is optimal because UE4 may have done this already for us considering UE4 is primarily an FPS game engine.

Yea, that sounds great!

Do you know any way I can get the .raw output?

In a few tutorials I’ve found it says you can right click on the image and it will give you “Export to .raw file” in the menu that pops up. But, this was replaced with “Export to .png file” and I don’t know where that option went. Did UDK just remove it, and that’s it?