Maya
Lego Bricks Simulation
As outlined in the RenderMan Section, the basic aim of this project was to create a still image of a pile of Lego Bricks. The first task was to model a single brick and the image below shows a render of the final geometry.
Once the brick geometry was completed, a basic box was created to match the dimensions of the brick's bounding box. The pile of basic box objects was gradually built up by dropping a small number of active rigid bodies onto an increasing amount of box objects. The image below shows the Maya scene as a new set of boxes is added to the pile.
Once the pile was sufficiently large enough I wrote a MEL script to create a RIB file that included the transform matrix details of each box. The MEL example code below highlights a useful command for writing to an external text file.
// Open the file for writing
cmdFileOutput -o "myFile.txt";
// Print to the file
print( "This will appear in my text file." );
// Close all open files
cmdFileOutput -ca;
The RenderMan Section of this project explains the process of rendering the scene in greater detail.