The surface shape of a three-dimensional object is acquired with an opticalsensor. The sensor, which has a projectiondevice and a camera, is configured to generate three-dimensional data from asingle exposure, and the sensor is moved relativeto the three-dimensional object, or vice versa. A pattern is projected ontothe three- dimensional object and a sequence ofoverlapping images of the projected pattern is recorded with the camera. Asequence of 3D data sets is determined from therecorded images and a registration is effected between subsequently obtained3D data sets. This enables the sensor to be movedfreely about the object, or vice versa, without tracking their relativeposition, and to determine a surface shape of the three-dimensionalobject on the fly.