Shape-from-shading for matte and glossy objects