Exporting clean heightmaps from QGIS

I’m sure my fellow 3D artists felt dread just by reading the title and thinking “Great, another software to learn.”. After all, the list of software we have to learn over the years has skyrocketed.

Average 3D artist (re)evaluating his life choices as he’s about to learn another tool.

However, If you dabbled with terrains in 3D you’ll eventually learn the possibility of increasing the fidelity of your terrain by using real world terrain data, not too difficult to find by using certain keywords like DEMs(Digital Elevation Models) or LiDAR in your search. Problem is, the formats we find are not always super-friendly to the tools we regularly use. I had 25k GeoTiffs that crashed on every application that I tried to load it on. What to do?

Enter QGIS(Thankfully, it’s free!).

From the Top bar: Settings>Options…>General>UI Theme: Night Mapping. Thank me later.

I'll be honest, I learned the bare minimum of this tool to get by. Adding labels, grids and weather color bands to acquired DEMs is simply not on my roadmap(I always intend my puns, get used to it.). So I pretty much want to import a super heavy GeoTiff or similar, remap it in scale and/or resolution and export it so I can move on with the terrain work. Should be easy right?

Well yes, but actually no. You have the option to export an image(QGIS calls it Raster) as raw 32-bit GeoTiff or as a plain image. Problem is, as an image it only exports it as 8-bit jpgs or pngs, and if you’re still reading this you’re likely aware that 8-bit is simply not enough bit depth for terrain work. Exporting as raw 32-bit GeoTiff data is not guaranteed to be open by other softwares, and changing it to 16-bit in tools like Photoshop will force you to deal with tonemapping the data, which is clearly not the way to go. Your other options are super weird formats that geography folks use, be my guest to try them though.

Thankfully, QGIS has a plugin ecosystem built in its UI, much like Blender or Unreal Engine. One of the plugins is called Heightmap Exporter and it does what it says on the tin: A simple way to export 16-bit pngs heightmaps, but not only that: It also displays the current raster layer height and extends, which is crucial when working with real world distances, as you probably should. Especially useful if you manipulated your DEMs with operations like cropping, clouding the real current values of the data provided by your DEM.

After enabling it, you can access it from the top bar: Raster>Heightmap Export.

Pay attention to which fields are in meters and which are in millimeters.

From there, is there prettty straightfoward, as soon you fill the information in one of model fields, the rest will be computed automatically. Pay attention to the ratio between meters and millimeters to make sure everything is as it should. In any case, here’s a link to the tool GitHub with more instructions: https://github.com/ClayJarCom/HeightmapExport

I know I just said I learned the bare minimum of this tool, and I intend to keep it that way. Still, There are operations that this software can do that can come in handy, like cropping, merging and remapping ranges. But that’s a story for a future post.

See you next mission.




Previous
Previous

Incremental Backups with Subversion