Planet formation process as a phase transition