DEM conversion:
The resulting PNG file and Octave scripts you can get
here.
The output file is a 16-bit greyscale PNG, where pixel value is 32768 + 10*elevation_in_meters.
Please let me know if the PNG file is suitable for use in Unity.
HOW-TO for doing the conversion yourself:
1. Install Octave from
this link.
2. Create directory, e.g. c:\bathymetry.
3. Put the .m files (from
here) in the directory.
4. Go to
this site, select the region you like, then click "Download Entire 3 Arc-Second Grid" -> XYZ. (Note: if you go for 1 Arc Second grid, then see step 11). Unpack the zip and put the resulting .xyz file under c:\bathymetry, e.g. c:\bathymetry\hawaii_crm_v1.xyz
5. Launch Octave.
6. At the command prompt enter:
cd('c:\bathymetry');
7. Load the DEM file:
xyz = load('hawaii_crm_v1.xyz');
8. Go get yourself a coffee.
9. Save the file as a binary version to speed up subsequent loads:
save -binary hawaii.dat. This will enable you to load the DEM from the binary file by doing
load hawaii.dat, which will be much faster.
10. Convert the DEM:
maketile(xyz, [-157 -156], [20 21], "t.png");. The second parameter is the longitude (X) range (157W to 156W), the third parameter is latitude (Y) range (20N to 21N) and the fourth parameter is the PNG file name.
11. If you are using a DEM with resolution different than 3 arcsec, then pass the resolution as the fifth parameter to maketile. For example, for 1 arcsec DEM use:
maketile(xyz, [-157 -156], [20 21], "t.png", 1/3600);