We describe a technique for improving the accuracy of range maps measured by time-of-flight (TOF) cameras. The technique is based on the observation that the range map and intensity image measured by a TOF camera are not independent but are linked by the shading constraint: If the reflectance properties of the surface are known, a certain range map implies a corresponding intensity image. We impose the shading constraint using a probabilistic model of image formation and find a maximum a posteriori estimate for the true range map. We present results on both synthetic and real TOF camera images that demonstrate the robust shape estimates achieved by the algorithm.