Tutorial: Filling holes

Radar scans of the ground (or of planetary bodies) often have "void" areas of missing elevation data due to various observation interferences. Here's how to fill such holes with Leveller, using the basic idea of interpolating elevations between the hole's edges.

This is the terrain as it should be. We will use it in our example to extract "hint pixels". In real life, you would either estimate such hints or copy them from another file.

This is the hole (void region). Select it by choosing the Magic Wand tool, set a tolerance of zero, and then click anywhere inside the hole.

If you use a smoothing process to fill the hole, use Filter, Elevate... to raise the hole's floor to match the lowest part of the hole's rim.

If for some reason the hole's floor is higher than the terrain's lowest point (which could confuse the Magic Wand tool into selecting outside areas) you can prune mis-selected areas with the Arbitrary Select tool and the Ctrl key.

You can also hold off selecting until after creating any hints (see the next step).

The narrow ridges are elevations placed inside the hole to help the upcoming interpolation. Any data you can provide (or guess at) is useful. An even distribution of islands or a cross section (as shown) is good. You could even brush in your best manual approxmation; just make sure you leave some void areas and that you can easily select them.

Make sure none of the hints are selected.

Next, we do a 5x5 Multismooth of several thousand iterations. If the Level connect option is not used, however, it tends to interpolate to the hole's rim and ignores the hint pixels.

With the same hints, however, using the Level connect option does a better job. The Level Connect plug-in can also be used, and may require fewer iterations and run faster. If you are using Multismooth, make sure the hints are fully unselected.

 
All that's left is some noise filtering (and probably some brushing) to make the smooth patch more closely resemble the surrounding terrain.

If you have really large holes, you can draw elevated contour lines over the hole, select the hole with the Magic Wand, and then choose the "Shapes, Heightfield from Points..." command, which will build a convex hull from a point cloud suggested by the lines. The selection mask will limit the hull to replacing only the hole.