Watch in disbelief as floating pieces magically assemble into a ghastly space vehicle!
My cheesy Lego assembly animation system for POV-Ray
V0.63 Beta!
I had seen some animations of Lego models being put together, such as in the commercial for the Honda Element or this other video I once saw where a castle is put together by bricks falling from the sky. I thought a while about how they accomplished that and wondered if I could come up with my own version. Here's what I have come up with so far, in case anyone is interested.I wanted the system to be configurable so that I could easily plug in different models and watch them assemble. I decided to put the pieces into arrays, defining what each piece was (organized by steps just like in the building instructions) and where it was positioned. I loop through each step, and through each piece in a step. As time progresses I move each piece closer to its destination position. I offset the timing of each piece (and step) so that they fall into place in order rather than all at once.
(By sequencing them in this way I don't have to worry as much about the pieces going through each other. Furthermore, with each piece definition I give a starting point; I can help keep pieces from colliding by giving them a clear path from their starting points to their destinations. Taking into consideration which pieces precede others in the construction process makes this task easier.)
I use Chris Colefax' ClockMod macro for Pov-Ray to accomplish the smooth movement of pieces. I couldn't have done much without it. (I tried.) The ClockMod system also does rotation so I threw that in for each piece as well. Spinning parts look cool.
My first test model had to be something small and simple so I went with the standard Classic Space buggy.
Here are some bits of POV-Ray code used to set up the Space Buggy model and create the animation.
Things I want to improve:
- make movement paths less linear, maybe automatically-generated splines
- define more interesting rotations
- bigger models!
- option to assemble by all pieces sequentially rather than divided by step
- make the wheels on the buggy turn forward!
V0.64.7.3!
I fixed a few issues and added some new features to the process. I tested out the process with a slightly bigger model, set #442 - Space Shuttle.The scene is more cluttered and there may still be some pieces passing through one another, but it's interesting to watch. The shadows are annoying too.
V0.64.7.9!
A couple more of the wanted improvements listed above are now covered.I chose to animate this one with all the pieces placed sequentially rather than by step. I did this by running through the piece array and copying each piece to a new array where all the pieces are listed in just one step. Then I copy it back as the original array. Pretty sneaky, sis.
You get a bigger spaceship this time. Can you tell which one from the thumbnails?
No, not that one, but maybe next time.
V0.64.8.3
I experimented with some changes to the script so that the pieces would rise from below instead of falling from the sky.I thought that this could represent the model growing from the ground piece by piece. I started each piece very small and then scale it to normal size as it is moved into place. Sometimes a piece looks as if it is sprouting from other pieces. Better than my real-life lawn, that's for sure...
I liked the 'growing' effect produced with this technique so I made it the centerpiece of a full-length (well, 30 seconds) video. Have a look here!