Optimize the material creation.