Electrolytic or electrophoretic production of coatings containing embedded materials