Desert ants of the genus Cataglyphis perform large-scale foraging excursions from which they return to their nest by path integration. They do so by integrating courses steered and the distances travelled into a continually updated home vector. While it is known that the angular orientation is based on skylight cues, it still is largely enigmatic how the ants measure distances travelled. We extended the ants' task into the third dimension by training them to walk within an array of uphill and downhill channels, and later testing them on flat terrain, or vice versa. In these tests the ants indicated homing distances that did not correspond to the distances actually travelled, but to the ground distances; that is, to the sum of the horizontal projections of the uphill and downhill segments of the ants' paths. These results suggest a much more sophisticated mechanism of distance estimation than hitherto thought. The ants must be able to measure the slopes of undulating terrain and to integrate this information into their "odometer" for the distance estimation process.