Created
December 31, 2014 17:51
-
-
Save apollolm/350c21e54ac8d8129fae to your computer and use it in GitHub Desktop.
Converting DEM (or other raster format) to RAW for import into Unity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gdal_translate -ot UInt16 -scale -of ENVI -outsize 1025 1025 Seattle_16Int.tif seattle_heightmap.raw | |
-of ENVI means it will write out RAW | |
This works fine. However, importing this .raw file into Unity produces an Vertically inverted terrain. | |
I opened with Photoshop CS, then did Image > Flip Vertical. | |
“Save As” Photoshop RAW. Options were blank, but saving worked. | |
Loaded into Unity as a terrain setting. Then manually set the Terrain height to 75, which when walking around seems right. | |
—Clipping Mars DTM (Using BBOX from QGIS to make the output RAW file a sqaure so as not to distort) | |
gdal_translate -ot UInt16 -scale -of ENVI -outsize 1025 1025 -projwin -2536.49776765 2965965.13578 795.125518636 2963086.69294 /Users/ryanwhitley/Documents/UnityProjects/ImportDEM/Data/Mars/DTEEC_025366_2305_025498_2305_A01.IMG /Users/ryanwhitley/Documents/UnityProjects/ImportDEM/Data/Mars/Mars_Crater_Clipped.raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment