fixed material morph calculation and unit tests