The goal of the project was to quickly learn the basics of using python, mel, RIB files, and RenderMan. This was done by creating a Sierpinski Fractal script that would output both a mel script and RIB file. The mel script allows for quick viewing of the fractal. While the RIB file was used for the final renders using RenderMan.
Waclaw Sierpinski received a degree in mathematics and physics in 1899. He has contributed many papers and books in the field of Mathematics. There are three well known fractals that he found (the Sierpinski Triangle, Carpet and Curve). In my script I use the Sierpinski Triangle for the fractal equation. Where you can select any random point inside of a tetrahedron and achieve the similar results everytime.
Sierpinski Triangle Steps: 1. Designate points for the fractal to use 2. Generate a seed point 3. Pick a random point 4. Find the midpoint between the seed and random point 5. Store the midpoint in an array 5. Set the seed point to the midpoint 7. Repeat step 3 – 6 n times
Initial Mel Script
To visualise the sierpinski data I generated a polyCube for each data point. This allowed quicking viewing in Mayas viewport. In the beginings of this script I only used 100 data points. Then I began adding more and more points for that data. Eventually Maya crashed when the script was ran.
To resolve the issue of Maya crashing I added a new python module. This module would generate points inside of a RIB file. These points are roughly the same points as the Mel Script’s. However the number of points that can be used is exponentially larger. This is because they are not rendered in Maya’s viewport, which shows a bounding box of the points.
Increasing Work Flow
Up to this point of the project I had to manually run the mel script. Then create a new RIB Archive in Maya and assign it to the RIB file. This means that I would have to reapeat these steps each time I made a new fractal. To optimise my time I added the use of using commandPort function in Maya. This allowed my scripts to call maya to run the mel script. In the mel script it now tells Maya to create the RIB Archive and assign the RIB file.
Fun with Sierpinski
After all my scripts were working properly I began to use new sets of points and altered the midpoint formula.
This was a great way to play with python, mel, RIB files, and RenderMan. It gave a real world problem to solve. I am sure that there are improvements that could be made in the future. Where the entire script could be in Maya and the user could select a group of vertices in Maya and generate the Sierpinski based of the vertices.