I'm a doctor, not a mechanic

UE2:Exporting heightmaps

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Unreal Engine 2 games store terrain height maps as grayscale images with 16 bits per pixel. To port terrain to a different game or to edit the height map in an external application, you need to export the terrain height map first. The result will be a 16 bit Windows Bitmap file that needs to be edited in special applications, such as G16ed. Almost no regular image manipulation tool supports 16 bit grayscale images, some interpret it as 16 bit color image, some reduce the color range to 8 bit.

Export via UnrealEd[edit]

If the game supports it, you can use the UnrealEd 3 or BatchExportCommandlet that comes with the game to export the height map texture as BMP.

Export via UTPT and G16ed[edit]

Pop-up menu of the Texture object with the "Analize Raw Object" entry.

If the game doesn't support texture export, you can try using UTPT and G16ed to extract the raw texture data of the height map. Unfortunately UTPT does not support G16 texture export, but it will help finding the parameters for G16ed's RAW import:

  1. Open the package containing the height map (usually the map file itself) in UTPT.
  2. Browse the Export Tree or Export Table to find the height map texture.
  3. Right-click on its entry in the list and select "Analize Raw Object". [sic] A hexeditor-like view should open.
  4. In that view's menu select Format -> Auto format. UTPT now auto-formats the raw texture data by interpreting the data and adding background colors to th various fields. You don't need to worry what most of the field actually mean.
  5. The "Format" property with a byte value of 10dec.
    Hover your mouse over the various fields marked with gray background to find the property Format and check its value. It should be '10', which stands for ETextureFormat.TEXF_G16, meaning 16 bit grayscale. If it's a different value, you can skip the remaining steps and just export the height map directly with UTPT.
  6. Next find the fields USize and VSize (not UBits and VBits) and note their values as the height map's X and Y dimension respectively.
  7. Select the first byte of the large yellow data block labeled MipMapData.
  8. At the bottom of the raw analysis view there should be a label reading "Offset in Package: 0x...", the value after "0x" is the height map data's start offset in the package file in hexadecimal notation.

Now you're ready to extract the height map with G16ed:

  1. Select File -> Import -> RAW data... from G16ed's menu.
  2. Enter path and file name (with extension) of the package file in the File field or select it through the "..." button.
    Note that the open file dialog assumes the file extension "raw" by default. Just enter "*.*" in the file name field there and press enter to see all files.
  3. Leave Bits per pixel at 16 and Byte ordering at "Little-endian (Intel)"
  4. Enter the height map dimensions you found with UTPT as the Width (USize) and Height (VSize)
  5. Enter the Data start offset in decimal notation. You can use e.g. the Windows Calculator to convert the value:
    1. Switch to scientific mode (menu View -> Scientific)
    2. Switch to hexadecimal mode (press F5 or click on Hex)
    3. Enter the hexadecimal value
    4. Switch to decimal mode (press F6 or click on Dec)
    5. Copy/paste or manually enter the displayed decimal value in G16ed