Prediction of defects in material processing