Three-dimensional pattern formation in semiconductor microcavities