- Sourceforge Page
- Blender3D
- Legends: The Game
- Planet Penguin Racer

Mesh-To-Heightmap Generator

mesh2hmap is a simple command line tool for converting 3D meshes to raster heightmaps. This tool allows you to create terrains in your favourite 3D modeller and then easily convert to a heightmap.

Currently mesh2hmap reads only VRML meshes (1 and 2) and outputs a portable grey map (PGM) or portable pixel map (PPM). A PPM is output only when a colour gradient heightmap has been specified.

Why is this useful to me?

CAD software and 3D modelers allow you to create much more complex terrain geometry than you can with a terrain editor or paint program. Even the 3D terrain editors have no way of creating certain geometry that is easily created with a CAD program, and the 3D model will be easier to tweak to get the right curvature of a hill or spacing between a jump and its landing.

The idea is for you to create your terrain (or a specific part of it) with a 3D modeler then quickly and easily convert it to a heightmap. Creating heightmaps in 3D modelers by texturing with height-based gradients is an unecessarily long process (see here). You don't have to create all of your terrain in the 3D modeler. Creating an entire terrain in a 3D modeler can be tedious, so if you're just after a hill, canyon, jump, etc. of a particular shape, you can create it, then additive-paste it with an image editor into your existing heightmap.

Once it is a heightmap you can import it into a 3D/2D terrain editor for more tweaking or put it straight to use. If a hill needs to be slightly wider or taller, or the gap in a jump slightly longer, all you have to do is change a dimension in your CAD program and run mesh2hmap again. Trying to do this in an image editor can be tedious.

This tool was created for generating terrains in games such as Legends (a Tribes inspired First Person Shooter) and Planet Penguin Racer (the GPL'ed branch of TuxRacer). However, it can be used in any application that uses heightmaps.