SpringUV - Minimize distortions from planar UV mapped terrain

Aug. 17, 2010

A common approach to UV mapping terrain is to use planar mapping. This works well except with steep faces where the texture gets stretched. Solutions like tri-planar mapping can remedy this, but introduce other artefacts and are hard to get seamless. The picture below illustrates stretching artefacts with planar UV mapping.

SpringUV transforms the UV coordinates of planar UV terrain mapping and expands areas where steep faces are present while compressing the surrounding flatter areas.


  • Import/conversion of height bitmaps to mesh
  • recalculation of UV coords




Springuv is a python package and is installable by any of the following commands:

cd springuv; python setup.py install
easy_install springuv


To compute correct UV coords there are two steps. First convert some heightmap to a mesh.

springuv heightmap2mesh input.tif planar_uv.mesh

Now compute a corrected mesh of the planar uv mapped one.

springuv calculate planar_uv.mesh corrected_uv.mesh

You can inspect meshes with the command

springuv view some.mesh texture.png

Mesh file format

In order to use the corrected UV coords, you need to extract them from the mesh file. The mesh file is a zip archive containing a file verts (your vertex info), uvs (the UV cords you need) and faces (an integer list of vertex index into verts usable for drawing indexed vertex triangle lists).

The layout of these files is flat raw format, i.e. row/column order after the formula: x+width*y.


GNU AGPLv3 or later, Copyright 2009 Florian Bösch