Smoothing splines have been used in machine vision to reconstruct visible surfaces of objects in the scene from depth data. While they remove noise from various sources, they exhibit poor performance along edges and boundaries. To cope with such anomalies, we study a more general class of smoothing splines, which preserve corners and discontinuities. Cubic splines are investigated in detail since they are easy to implement and provide satisfactory results for most applications. In particular they produce smooth curves near all data points except those marked as discontinuities or creases. We also introduce a discrete regularization method which is used to locate corners and discontinuities in the data points before the continuous regularization is applied.