By: Ahui Herrera [4]
Posted: June 14, 2002
Version: 1.0
Section 1: Requirements
Knowledge
Basic computer skills
Knowledgeable with POV-Ray (beginner level)
Knowledgeable with .ldr to .pov conversion
Software
LDraw System Tools [5]
POV-Ray [6]
DivX Codec [7]
Ulead MediaStudio Pro 6
Files
3439_SpyPlane.ldr [8]
3439_SpyPlane.pov [9]
StepClock.ini [10]
Optional Files
SpyPlane.avi [11]
(Final Animation)
Section 2: What Will This Tutorial Teach You
This tutorial will show you how to create a LEGO
animation showing how to build a model. We will focus on converting
an .ldr to .pov file, the creation of an initialization file (.ini)
that will let POV-Ray render the instruction images needed for the
animation and the creation of an .avi movie file.
Section 3: Step-By-Step
Stage 1: Creating the LDraw Model & Converting It
Step 1: Adding STEPs to a LDraw File
In order to create
step-by-step instruction animations of a LEGO model you must add
STEPs into the LDraw model file. The easiest way to add STEPs is
when you are creating your LDraw file. The image below shows the
3439_SpyPlane.ldr file instructions in MLCad.
The red highlight instructions are the STEPs. As the word implies you are adding steps to your model. In the image above the first step will have 2 pieces; a 2x8 plate and a wedge. The 2nd step will have one extra piece than step 1: a 2x6 plate. Once your model is done it is time to convert it to a POV-Ray file.
Step 2: Converting .LDR to .POV
I will use L3PAO to
convert our model file. For more information on what L3PAO can do
read the Lego Conversion tutorials. In a nutshell L3PAO is a
front-end for L3P, which is a DOS program that can convert an LDraw
file into a POV-Ray file. In our case the only important thing to
remember is the “Stepclock” switch.
As the image above shows make sure you check off the Stepclock switch. This will let POV-Ray know that you are going to create step instructions of your model. Once you have set the rest of the options to your liking run L3PAO. Make sure that you UNCHECK the render upon completion option in L3PAO.
Stage 2: Rendering Using POV-Ray
Step 1: The .INI File
Open the 3439_SpyPlane.pov and
StepClock.ini files that I have provided in POV-Ray. You can create
your own .ini files either in a text editor (notepad) or within
POV-Ray. Ini files let POV-Ray know what file to render, the size of
the images, file format and many other things.
Above is the StepClock.ini file that I have provided the reader with. Note that the image above has red numbers, which are NOT part of the file. These are for illustration purpose only.
Red 1 provides comments of what the .ini file is about. Comment lines are provided by the ‘;’ symbol. Comments lines are NOT required in ini files but make it easier for you and others to understand what the file is about.
Red 2 informs POV-Ray of which file this ini file is associated with.
Red 3 tells POV-Ray how many frames (images) to create when running POV-Ray. The numbers of frames will depend on how many instruction steps you have. Do you remember how many steps we created for the 3439_SpyPlane? You could open up the .ldr file and manually count the number of STEPs or do it the quick way. Look at the 3439_SpyPlane.pov file and scroll towards the bottom of the file.
Looking at the code above we see that above the code line of object {_3439_Spy… } we see that there is a command stating #if (clock > 27). As you might have guessed this is the final instruction number. So going back to the ini file we see that we will start at frame 1 and go until frame 27.
Red 4 provides the output size of the frames. Look at the QUICKERS.ini file for some common sizes or create your own. We will be using 320x240 because this is a good size for good quality movie file.
Red 5 provides a list of various file formats that you can give the output files. In our case we will be using PNG because Ulead MediaStudio Pro can handle this type of format to create movie files.
Step 2: Rendering
Before we can render we must let
POV-Ray know that we will be using our own ini file and NOT the
default ini file. In POV-Ray click on the ini button to open up the
ini options. Use the browse button and look for your ini file
(StepClock.ini for this tutorial). Click on the “Set But Don’t
Render” button to close the pop-up options. Now click on the
3439_SpyPlane.pov file and then the run button. POV-Ray will begin
to render your frames. Depending on your system this may take a few
minutes. In the end, however, look in the directory where you placed
your 3439_SpyPlane.pov file. You should find 27 new files called
3439_S01.PNG through 3439_S27.PNG. These are you frames!
Stage 3: Creating An Animation
There are many video editing software packages available. I will be using Ulead MediaStudio Pro 6.0 because it’s the one I have and is pretty easy to use for our purposes. In a nutshell we will be creating a video file using the .avi format. Think of this format as a container that holds a) your movie, b) what type of compression you use for the movie, c) your sound (if any) and d) the compression you use for your sound. You don’t have to compress your video or sound if you don’t want to, but without compression video and sound files are huge! One example of a compression codec is very popular MP3 format. In our case, our animation will have video only. We will use the DivX 4.11 video codec because it’s one of the best ones in creating a high-quality video while keeping the final file size reasonable. Okay we are now ready to begin the final stage.
Step 1: Opening Ulead MediaStudio
Locate the Ulead
MediaStudio Pro 6.0 folder in the Programs Folder of Windows and
click on the Video Editor 6.0 icon. After opening MediasStudio you
should see two windows: a timeline window and the Video Editor –
Untitled window. Your screen should look like the one below
Step 2: Importing Our Images
Click on the insert menu
on the toolbar menu of the Video Editor window and then image file.
A pop up window will appear. Now browse for the folder that has the
3439_SXX.png images. Locate the LAST file; The one that says
3439_S27.png. Click on that file. Now hold the shift key and use the
up arrow to select the rest of the files. This ensures that when you
import the images 3439_S01.png is the first image shown and not
3439_S27.png. Now before you click on the open button look at the
duration numbers. There are four sets of numbers here. One for the
hours, minutes, seconds, and frames. As you might have guessed this
lets MediaStudio know how long each image should be. In our case we
want each image to be a second long. So set the numbers to 00 for
hours, 00 for minutes, 01 for seconds, and 00 for frames. Now click
on open.
Step 3: Inserting Images To Timeline
Your mouse should
turn into a finger. Drag the finger to the timeline window and place
the imported images into the VA timeline section. See image below
for details.
The timeline image above has a lot of information. For our purposes we only need to worry about the VA timeline section. This section of the timeline deals with the A-Video. You can have multiple videos sections (VB, V1, V2, V3) when doing your movie but for our case we only need to concentrate on the VA section. Below the video sections are the Audio timeline sections. Aa corresponds to the audio section related to the video in section A. There is one special timeline section called Fx. This is for special transitions or effects.
Step 3: Adding A Title & Credits
This is an optional
step. If you do not want to add a title and credits to your movie
then go to the next step. You can edit the optional files I have
provided to make your own title and credits. Or you can create your
own using any graphical program. Just remember that the dimensions
of the movie are 320 x 240. First we need to move the imported
images on the timeline. Grab the animation clip and drag it to the
V1, V2 or V3 timeline section. The location is not important right
now.
Next insert the image called Title.png to the VA timeframe and give it a duration of 3 seconds. Insert the image Title.png again and this time give it a duration of 1 second and place it next to the 3 second duration. Now insert 3439_S01.png and give it a duration of 1 second but put this image on the Vb timeline right below the 1 second Title.png image. Your timeline should look like this.
Note that I have enlarged my timeline so that it is easier to view. Your timeline images may be smaller than this. Click on the icon in the red circle of the image above to look at the timeline display options.
Now click on the Window menu and check off the Production Library. A new window should appear called Production Library. This Library houses an assortment of special effects that can be placed on the FX timeline section. Choose the one you like and drag it onto the FX timeline between the two 1-second images. If you double click on it you can get more options for the particular effect your choose. Your timeline should now look like this. Note that your images may vary.
Now place the animations images we imported early on the Vb timeline. Next we insert 3439_S27.png onto the Vb timeline with a 1 second duration after the animation clip. On the Va timeline in the same location as the newly inserted 3439_S27.png slot we insert the credits.png image also with a duration of 1 second.
Choose another FX effect from the production library. Next insert the credits.png image again with a longer duration say 3 seconds. Your timeline should now look something like this.
Note that I have added something else after the credits image. Also look carefully at the arrows on my FX timeline section. They go down, up and then down again. Make sure that yours do the same go down and then up or vise versa depending on where you started you video. To change the direction of the arrow double click on the effect and choose the correct direction from the option window that appears.
Step 7: Creating the Video
Okay we are now ready to
create the .avi file. Under the file menu of MediaStudio look for
the create option. A small pop-up window will appear with several
choices. Click on the Video File and a small pop-up window will
appear. In the filename box type in “SpyPlane”. Now click on the
Option button and click on the compression tab. The default value
for video compression is none. Scroll through the compression
options until you find the DivX4.11 compression. Once selected click
on the OK button. In the description area write “<YOUR name>
copyright <CURRENT year>”. Finally choose a location to save the
file and click on the save button. MedisStudio will now create the
animation.
Step 8: View the Animation
Now go look for your file
and double-click on it to see your animation. Congratulations you
are done!
Final Thoughts
You might have
noticed that our movie seems to run a bit slow. This is a matter of
personal taste but to fix it is easy. All you have to do is give
each frame a smaller duration. For a cool effect try having the
animation go from instruction 1 to 27 and then back down again.
There is a way to create the frames WITHOUT using the ini file that
we used in this tutorial. One can use command lines to set the
number of frames. I use ini files because that was how I learned and
it’s easier to teach someone how to do it that way so they know what
they are doing and not just typing in code. Read the various posts
in the CAD group on LUGNET [12] if you want to do it the quick command
line way. I hope you enjoyed and learn something new from this
tutorial. If you have any questions feel free to email me at
ahui@ldraw.org [13] or visit my website
at http://jedi_agh.tripod.com/ [14].