implemented the example to use materials.