Gah - a solution with more questions. – EntropicLqd
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
|This short section needs to be expanded.|
Export via UTPT and G16ed
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:
- Open the package containing the height map (usually the map file itself) in UTPT.
- Browse the Export Tree or Export Table to find the height map texture.
- Right-click on its entry in the list and select "Analize Raw Object". [sic] A hexeditor-like view should open.
- 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.
- 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.
- 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.
- Select the first byte of the large yellow data block labeled MipMapData.
- 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:
- Select File -> Import -> RAW data... from G16ed's menu.
- 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.
- Leave Bits per pixel at 16 and Byte ordering at "Little-endian (Intel)"
- Enter the height map dimensions you found with UTPT as the Width (USize) and Height (VSize)
- Enter the Data start offset in decimal notation. You can use e.g. the Windows Calculator to convert the value:
- Switch to scientific mode (menu View -> Scientific)
- Switch to hexadecimal mode (press F5 or click on Hex)
- Enter the hexadecimal value
- Switch to decimal mode (press F6 or click on Dec)
- Copy/paste or manually enter the displayed decimal value in G16ed