A Heightmap for a Game Engine: 16 Bits and No Larger Than 4096×4096

2026-11-245 min read
UnrealUnity

This is a walk through one common pain that game developers, modders and 3D terrain fans keep raising on forums. There are no names here, only what goes wrong, why, and how the site makes a heightmap. If you are moving real terrain into a game engine, this article is about you.

What hurts

Terrain is not needed "in general"; it is needed cut to fit the engine. The landscape input has a hard requirement: RAW 8 or 16 bits, no larger than 4096×4096 per tile. Someone takes a digital elevation model and tries to export a whole area, and most tools complain that the size will be astronomical. Then the manual work begins: crop, resample, convert to 16 bits, and fit the side to a size the engine accepts without stretching. Every one of those steps is a chance to lose height precision or shift the terrain by a pixel.

The second ceiling is an honest one, and forum members say it themselves: you cannot turn honest 90 metres into honest 10. You cannot get information out of the absence of information. You can stretch the grid, but it will not gain any detail by being stretched.

How the site solves it

In the wizard the heightmap side is chosen from four sizes that game engines accept directly on landscape import: 505, 1009, 2017 and 4033 pixels. The default is 1009², the largest is 4033², and that fits inside the engine's 4096 limit.

A note about the server: the server itself knows a row of six Unreal landscape sides, 127, 253, 505, 1009, 2017 and 4033, and snaps any side it receives to the nearest of them, or to the smaller one when two are equally close, because it is cheaper in memory. The ceiling is a server setting within the range 127 to 8129, so the site does not take on a canvas that would make the processing machine run out of memory.

Diagram from the wizard code: canvas sides of 505, 1009, 2017 and 4033 pixels; 1009 is the default, 4033 the largest, the engine limit is 4096; this is a diagram, not a screenshot

The archive holds three things: a 16-bit greyscale PNG, a raw .r16 file for those who read the sample stream directly, and a text description with the height formula and ready scale values for Unreal, Unity and Blender.

What we measured

We placed two heightmap orders for the same hilly area, one with side 1009 and one with side 4033. The map is cut for the engine precisely: the archive holds a 16-bit PNG of exactly 1009×1009 and 4033×4033 pixels, plus a raw .r16 (uint16, little-endian) of 2,036,162 and 32,530,178 bytes. That is exactly side × side × 2 bytes, not a single extra row. The sample range runs from 0 to 65535, so all 16 bits are in use.

The description gives the formula: height in metres = −1.27 + sample / 65535 × 186.25. The side of the area is 5,566 m and the grid step is 1.38 m. The 4033² canvas was delivered in 5.0 s, with no reduction in size.

Diagram from our measured numbers: sides 1009 and 4033, a 16-bit PNG, an .r16 file of 2,036,162 and 32,530,178 bytes, which is side²×2; the 4033² canvas in 5.0 s; the height formula; this is a diagram, not a screenshot

What we have NOT proven

To be honest about the limits: the 1.38 m step is the step of the canvas grid, not the accuracy of the terrain. If the source elevation model is coarser, the site will not invent the missing detail. Ninety metres cannot become ten, and we do not promise that. We did not separately measure the accuracy of the source for our area in this measurement. We also did not test the import into Unreal, Unity or Blender themselves; we checked the sizes, the bytes and the formula. If your engine imports the map with an error or with the wrong heights, write to us with the engine name, its version and the scale you set, and we will look into it.

How to check your own file in a minute

Look at the size of the .r16: it must be exactly side² × 2 bytes. For 1009 that is 2,036,162 bytes; for 4033 it is 32,530,178. Open the PNG in any program that shows image properties: it should say 16 bits per channel and exactly the side you ordered. Take the height scale from the description, not by eye.

Questions people ask

Why 4033 and not 4096? An Unreal landscape is built from sections, and its recommended sizes are one more than a multiple of the section size. 4033 is the largest of those that still fits under 4096.

Do I need the PNG or the .r16? Either. The PNG is easier to look at; the .r16 is the same samples without any container.

More about the format is in heightmap format in depth, and for Cities: Skylines see a real-world heightmap for Cities: Skylines.

Make the same map Order a custom map

← All articles