Creating and modifying optical materials from a script