Globally consistent depth sorting of overlapping 2D surfaces in a model using local recurrent interactions