Depth sorting