modify materials function