Matthew Beckler's Home Page

Home :: Blog :: General :: Software :: Hardware :: Microcontrollers :: Artsy


Lego Rendering with POV-Ray

At the end of my first semester at Minnesota I got re-interested in using POV-Ray to make photo-realistic renderings of Lego models. I say re-interested because back in middle school I played around with POV-Ray a bit, but on my parents' 75MHz computer, things were a bit too slow. Now with a faster computer, I tried again. This time I was using linux, so the tool chain was a little different. If you are interested in trying this too, check out www.ldraw.org for an installation guide for your operating system, as well as good introductory tutorials.

Tools I used:


The first thing that I did was to try and follow the first tutorial on the leocad webpage, which teaches you how to make a simple car. I got kind of bored at the end, so I added a few guys, and expanded on the scene a little bit. And yes, the guy on the right is wearing a single purple transparent flipper, as well as an arrow quiver, a bow, and a transparent red gun. Here is the result of my first try:

Lego Car Rendering

I recently found some 3D images of things online, where you cross your eyes, superimposing two images together into one, tricking your mind into thinking it's actually looking at something real. I thought that maybe you could do the same with this, by shifting the camera slightly. I just have to cross my eyes so the flying ninja guys line up, and then I can see the coolness:

3D Stereo Image Rendering

Someday I'll get around to making a 3D movie this way. Oh yeah, I finally did that.

Here is a cool spaceship that I made one day:

Space Ship


The next thing I did was read through the tutorial from the LDraw website about basic animation. The process is quite simple, and the most confusing part was step 2, where you actually use L3P to convert the .dat file to the .pov file. I was under the impression that you needed to do something special with the conversion, but all you need to do is to make the .pov file with just the model to be animated. I constructed a really ugly train, and got it to move across the screen. The videos are in MS_MPEG4_V2 format. They should work on both Windows and Linux. I haven't tried them on a Macintosh. Let me know if they don't work for you.

First Train Video
First video - 81k
Second Train Video
Second (much cooler) video - 137k

I wanted to try to experiment with motion more complicated than just plain linear motion, so I decided to try a swooping angled space ship shot. This required the use of not just linear (towards the camera) and parabolic (the vertical acceleration) motion, but also calculating and changing the ship's angle to be tangential to its motion (yay for calculus!). Here's the video:

Space Ship Flyby
Space Ship Flyby - 329k

Then I created a spinning 'near-miss' video with the same space ship model:

Space Ship Roll
Space Ship Roll - 233k


Scott, who also went to Memorial High School, said that my blue car looked like a lawn mower. I decided to show him what a real lawn mower looked like. Here is the video:

Lawnmower
Lawnmower Rotation - 422k


Update - January 12, 2007 - So I finally got around to creating a stereoscopic movie of some Lego models. As with the other stereoscopic images, just cross your eyes until the middle images overlap, tricking your brain into seeing a true 3D image. Hopefully the video codec works for you all.
Stereoscopic Spaceship Spin Video
View Video


LGEO Workaround

Hopefully this little problem will get fixed in future releases of L3P. To use the LGEO pieces, just add the flag "-lgeo" to your L3P command line. Then open up the newly created .pov file with your favorite text editor. Scroll down until you find the following line:

#if (version >= 3.1) #local L3_Temp_Vers = version; #version 3.0; #end // Avoid most warnings from LGEO

You will need to change the #version 3.0 into #version 3.1 to enable the LGEO macros. The line should look like this when you are finished:

#if (version >= 3.1) #local L3_Temp_Vers = version; #version 3.1; #end // Avoid most warnings from LGEO


Homepage Made with Vim! Validate HTML Email Me! Made with Inkscape! Validate CSS

Copyright © 2004 - 2017, Matthew L. Beckler, CC BY-SA 3.0
Last modified: 2010-03-21 12:50:03 PM (EDT)