Principles of 3D Animation: 3D StudioMax
Instructor: Aaron Ross
Final Project, Summer 2005
This was my project for an introductory 3D animation class. The goal of the project was to develop a familiar base for how animation is accomplished in a 3D environment. The course is not directed towards scripting or programming, however I decided to take the opportunity to get my hands dirty and introduce myself to the concept.
I have always been interested in the Rubik's Cube but I had never gone far enough to actually picked one up. After working on this project, while I do not claim to be a master, I feel that I know more about the cube then I ever thought possible.
First things first, I picked up a Rubik's Cube and learned how to solve it. For the sake of the project, I read the instructions that came with the cube instead of hacking through the motions myself. Once that was taken care of I disassembled the cube to fully understand how it worked. This step was not entirely necessary but in the end I think it helped a little. (People always say that they used to peel the stickers off in an effort to solve the puzzle. This seems strange to me now. It is easier to take it apart and put it back together in the solved state. Further more, if you don't put the stickers back in the correct locations the cube will never be solvable.)
The class that I was taking was taught in 3D StudioMax, so I used that to model each piece of the cube. I was still knew to the modeling process. Instead of using simple beveled cubes I actually modeled a corner, side and center piece of the cube trying to match them as accurately as possible to the piece's real dimensions. This was not completely necessary but was good practice for my modeling skills at the time. This also had a signifigant impact on the rendering time.
I didn't build an actual rig for the cube. The scope of the class did not cover rigging. I was presented with a challenge when it came to manipulating the pieces of the cube. Each time the objects of a face (4 corners, 4 sides, 1 center) was rotated, the adjacent faces now contained new objects. For every face rotation there was a new selection set. I used 248 face rotations to mix and solve the cube for my final animation. Doing these selections by hand became very tedious and frustrating.
In an effort to avoid such frustration I wrote a script to help. First I placed a helper/locator at each center piece (the center pieces of a Rubik's cube are do not move relative to the other center pieces) aligned with surface of the plane. This helper/locator was used to figure out which objects belonged to that face at any particular time. The script then linked those objects to the helper/locator which then allowed me to simply rotate the locator.
Scramble and Solve
In order to get the solving rotations in the correct order I first scrambled and solved the cube in the real world. I took a scrambled cube and solved it while taking notes as to which face rotations were required. I inputed these instructions into a spreadsheet where the face names corelated with the helper/locator names assigned to each face.
In order for a Rubik's cube to be solvable it must start in the solved position. Accounting for this I modeled the cube in the solved position. I copied the solving instructions that were previously recorded and reversed the order of the steps as well as the rotations. This gave me the scramble routine that matched the solve routine to ensure a complete solve at the end. The instruction spreadsheet also included the frames that the animation was to be keyed. Next I converted the spreadsheet into a comma delimited text file. The script reads the delimited file and loads the instructions into an array and processes the instructions into the scene. Ultimately, the script first keys the animation to scramble the cube and then keys the animation to solve the cube immediately after. The scramble was not rendered to give the illusion that the cube started in the scrambled state.
I would like to revisit this project now that my skills have improved. Not only do I want to make the model and script more efficient but it would be neat to implement a scramble and solving algorithm. The idea is to have the script randomly scramble the cube while then be able to solve the cube on it's own eliminating the need for the instruction file. (In progress)