|
Hi all, Does anyone have any hints/ideas/code for importing a heightmap from a binary raw file to a TerrainData object? I've tried opening a stream and using BinaryReader to read in the file, but I'm getting strange results..
(comments are locked)
|
|
A pure raw file generally does not have a header, so it does not contain any information about its resolution, bit depth, or byte arrangement. If you do know these, you can parse the file, which should have a size of exactly (xRes*yRes*bitDepth) bytes. If the bit depth is 2 bytes (16bit), you need to figure out the endianness (whether the most significant byte is the first or the second one). If your endianness is wrong, the imported map will jsut look like gibberish, and often resemble random noise. You also need to figure out whether the pixel rows are ascending (0->(ymax-1)) or descending ((ymax-1)->0), which might cause a vertical flip of the map. You should be able to figure out these settings by trial and error ;-)
(comments are locked)
|

Unless you know what file format the source is, it'd be impossible for you to do that.