Newton’s Cradle with Python and OSL shader

For this project, we had to utilize the Python code from the previous project to create Newton’s Cradle. Additionally, the Python code also needs to add attributes to each of the balls that can control the same OSL shader they are assigned. The user can change the colors, frequency, and offset of the pattern, bump map noise frequency and height, and the position of the cap by clicking on each of the balls after running the Python script.

Moreover, I also added nCloth to the balls in the Python script to make them bouncy and more interesting.

The result is really fun to watch, and it was also very fun to make. I have really learned that I can really do anything with Python and MEL inside of Maya. Creating textures with OSL is very fun as well. The only limitation is my imagination.