There are two basic concepts in creating the illusion
of movement. One can either move the object in question a few
increments over a series of several frames or the camera can move
around an object.
The first method was how the first cartoons were created. A
cartoonist would draw say a car with a blue sky and sun on a sheet
of paper that we will call a frame. This would become the 1st frame
of the cartoon. The next frame would again show the blue sky and
sun. This next frame, however, would show the car drawn a bit offset
from the first. After a series of say hundreds of frames if one
looked at them consecutively and fast the illusions of a car moving
could be seen. As one can see this method took forever and was time
consuming having to create hundreds of thousands of frames for a
full-motion cartoon. Thanks to advancements in technology and
cartoonist tricks this methods was soon streamlined.
I am not sure where or when the 2nd method was started, but I
would think it started in the movie industry with outer space films.
The concept is simple. Movement is relative to the viewer’s vision.
By moving a camera that starts off at a distance closer to an object
the final result on film is the viewer getting closer to the object.
If one adds a background to the object and makes the background move
as well the illusion that the main object is moving closer to one is
created. Think of fast moving star wars space ships. The small model
ships were NOT really moving. The camera was and the illusion of
speedy spacecrafts was achieved.
For this tutorial I will demonstrate the first method of
rendering. The second method is most useful when trying to create
the illusion of speed in space. This will be covered in another
tutorial (Lego Animation 102: Movement in Outer Space)
As stated in Step 2, we will have to code the animation in this
Step. This can be a daunting task for the non-coders but the steps
below have been created with these readers in mind. These steps
assume that the reader has already installed POV-Ray onto their
computer systems. Read the POV-Ray homepage
for installation instructions.
-
Create a folder called animation and move the .pov file create
in Step 2 into it. Open the .pov file created at the end of Step 2.
Ours will be referred to as 4565_Engine.pov in this tutorial. Upon
first inspection this file may seem huge and a challenge to read.
However, 98% of the information in this file will NOT be used.
-
At the top of the file you will see a series of #declare
lines. The only one important is the one highlighted in red.
#declare QUAL = 2; // Quality level…
Make sure that the quality level is equal to 2 for FINAL
rendering. It is recommended that you use level 1 when working on
figuring out where to place the camera and when doing initial key
animation frames if you have an older machine. Note that it is NOT
RECOMMENED that you use level 3 unless one owns a high-end
workstation PC or a dual-processor power Apple as rendering times
per frame will take 5+ minutes. Level 3 requires A LOT of processing
power and memory. The quality difference between 3 and 2 is not
noticeable for animations. If you are doing still images, use
quality 3 for the best results. I have done animation rendering on a
dual P-3 1.4 GHz & 512 MB Ram machine and the time was still
very slow.
-
Now scroll to the bottom of the file. Look for the highlighted
information in red in the image above. This is where the major parts
of the animation hand coding will take place.
Object { _4564_Engine_dot_dat … } is the command line
that tells POV-Ray that all the lines above it create the 3D train
engine. To this line we will be adding a command that will allow us
to move the engine train object across the screen.
Background { color rgb <0,0,0>} tells POV-Ray to create a
background with the color in parenthesis. One can change the color
of the background by changing the values of the numbers. Rgb stands
for red, green, and blue and acceptable values range from 0 to 1 for
each color. Values above 1.0 can be used to create a bright neon
color effect. The name of the game here is to experiment with the
values. 0 means no color while 1 means full color saturation for the
color in question.
Camera {…} is the command that lets POV-Ray know where
the camera should be placed and in which direction it should be
looking. The only thing to remember when working with the camera is
that in ldraw the sky is on the –y axis. Thus when rendering in
POV-Ray remember that the sky is in the –y axis.
Light_source {…} is the command that lets POV-Ray
know where to place lights in the environment. You need lights in
order for the camera to see. Think of those big lights used in the
photo studio. By placing the lights in various locations around the
object you can get different effects.
-
The biggest challenges we have to creating the
animation is to 1) find out where we want to place our camera 2)
where should the camera be looking at 3) how much to move our train
in each frame and 4) how many frames to create. By default our
object is centered at <0,0,0>. According to our storyboard we
want to see the train engine move from right to left across the
screen. Thus looking at the image below we should place our camera
off centered from the middle of the frame looking at the red dot.
To place the camera in the desire location we need to modify the
camera line. First delete everything that is between the { } of the
camera line. Next add the following lines
Note that I have changed the background color from black
<0,0,0> to gray <.5,.5,.5> To render the image 1) ensure
that the proper .ini file is being used. Click on the ini button to
get the POV-Ray from Windows render setting window. Ensure that the
name of the ini file is “QUICKRES.INI” if it is not click on the
default button and then click on the “Set but don’t Render” button.
The QUICKRES.ini file is the basic file used by POV-Ray for
rendering. Later we will create our own .ini file for our specific
animation. For now, however, we just need to quickly render some
still images. Next ensure that the image size is set to 160x120 No
AA. Under the New button is a small drop down window listing a
variety of image file sizes. For our purpose the smallest file size
is best since we are trying to get our coordinate system down right.
Last click on the Run button.
So how did I know what numbers to use? Trial and Error! We know
that the train engine is at <0,0,0> (x-axis, y-axis, z-axis).
Thus we need to move the camera on the x-axis. I first tried
<100,0,0> and the results were not good. The camera was too
close to the engine. So I moved the camera some more to
<2000,0,0>. At that position the camera was too far.
Experiment with different numbers to get the desired location you
want. I left the look_at location at <0,0,0> since this will
have the camera looking at the center of the train engine. You can
change this off course but for our animation we will leave it alone.
The angle command tells POV-Ray at what angle to place the camera.
Again experimentation is the best method here.
-
Okay so now that we have our camera in place we need to move
the engine to the right so that it starts off the screen. To do this
we will add a line of code to the object line.
We use the command line translate <0,0,-750> to move the
engine to the left of the screen. The translate command is used to
move an object. Again, how did I know what number to use? Trail and
Error, at first I used <-500,0,0> but this made the engine go
further back into the screen. So I changed my movement from the
x-axis to the z-axis. I knew it would not be the y-axis as this
would move the engine up and down. Thus location <0,0,-750>
will be the first frame for the animation. This is storyboard 2!
Storyboard 1 will have nothing remember! Now we need to find the
location of where the engine will stop to fulfill the requirements
of storyboard 3. Again we can render another still image and change
the translate code or we can say that translate <0,0,0> will
put the engine in the middle of the screen and thus storyboard 3 is
complete. To finish up we need to know how far to move the engine to
get it off the left side of the screen. Again some more rendering
and we see that translate <0,0,750> is the cut of point. So to
summarize the key events for the train engine are <0,0,-750>
starts off at left side, <0,0,0> engine is at center,
<0,0,750> engine is at right side.
-
Okay now we are ready to create our animation but first we
need to create an .ini file for the 4565_Engine.pov file. The .ini
file will let POV-Ray know how many images to render and how much it
should move our engine in each image. It will also let POV-Ray know
what file to render, the size of each image and many other things.
Open up the 4565_Engine.ini that I have provided in POV-Ray. To do
this go to the ini button and use the browse to look for the file.
Then click on the edit button. You will see that the first line is a
comment line. It uses the “;” to denote that this line is just for
the reader to obtain information on the file. POV-Ray will ignore
this type of line. The next line informs POV-Ray what file it will
be rendering. In our case 4565_Engine.pov.
Now for a bit of what comes in Step 4, producing the video. At
the basic level a video can have 25 or 30 (technically speaking
29.97) frames per second. These are the US standards; European
standards are a bit different and will NOT be discussed here. In the
movie theaters they use 30 frames per second. What this means is
that each second the film camera is sending 30 frames to the screen.
The human eye sees this as continues movement. One can go as low as
15 frames per second but at that rate the human eye will start to
see that the movie is really a series of images. So we want to
create an animation in which the train takes 3 seconds to come in
from the right and stop at the middle. Then wait for 5 seconds at
the middle and finally take 3 more seconds to leave the screen. Thus
total running time is 3 + 5 + 3 = 11 seconds. At 30 frames per
second we need 30 * 11 = 330 images! Looking at our animation time
we can see that we have 3 smaller animations: a 3 second engine
coming in from right side of screen,a 5 second engine idle at center
and a 3 second engine leaving the screen. Thus we will have 3
rendering runs to do. This means that we will have at least 3 ini
files. One for each rendering run.
-
.ini File 1: Engine coming in
This rendering will require
90 frames. (3 seconds * 30 frames per second). So looking at our
4656_Engine.ini file we see that the initial frame will be 1 and
that last one will be 90. This will tell POV-Ray to create 90
images, beginning with image 1 through 90. Next we need to set the
clock variable. The clock variable will be used to move the train
engine. Remember how we found the end points using the translate
command. Well the initial_clock value will be –750 and the final
will be 0. This is where the beauty of POV-Ray lies in. POV-Ray will
calculate what the clock value should be for all the intermediate
frames 2 – 29 using the end point of the clock value –750 though 0.
But how will the 4565_Engine.pov know how to use the clock value?
Simply insert it in the object line. Instead of using translate
<0,0,-750> we add translate <0,0,clock>. Next up is the
size of each image. We were using 120x160 for testing purposes.
However, the final animation will be of the 320x240 size. This size
will make a decent size video file with good quality but not create
a very huge file. Look at the QUICKRES.ini file for different file
sizes. Next specify what type of file format you wish to output. In
our case we will use the N for PNG format since Ulead MediaStudio
Pro 6.0 can handle this type of format. One last note before we
begin to render. There are two comment lines in the 4565_Engine.ini
file that I will talk about briefly. Subset_Start_Frame = 1 and
SubSet_End_Frame = 30. If for some reason you need to stop the
animation rendering before all 30 images are complete. You can use
these commands to complete it at a later date. Say you stop the
animation when the 15th file is completed. If you then come back and
set the Initial_Frame = 16 and the Final_Frame = 30 then the clock
calculations will be based on 14 frames and NOT the original 30
frames. Thus you must use Subset_Start_Frame = 16 and
Subset_End_Frame = 30 for the clock variable to be based off the
original 30 frames.
-
Okay we are now ready to render. First set the correct .ini
file. Use the ini file button and browse for the 4565_Engine.ini
file and click on the “Set but don’t render” button. Now click on
the 4565_Engine.pov tab and click on the run file. The animation
should begin and now it’s a question of waiting for all 30 images to
be complete. You can pause the rendering by clicking on the pause
button in POV-Ray if you need to free up computer resources. You can
stop the rendering anytime by clicking on the stop button located
where the run button was at when you began the rendering. Note that
in this example our rendering times are small because we are using a
simple file. If you plan on creating more complex animations the
time it takes will increase. There are several ways to help decrease
this time. First, close any other programs you may have running.
Secondly, in the system tray (bottom right hand side of you PC)
close off any automated applications, (Disable anti-viruses
software, pop-up killer, etc.) and third before hitting the render
button go to the render file menu in POV-Ray. When the drop-down
menu appears go to GUI Priority and set to “lowest”. Next go to
Render Priority and set to “Highest”. Then hit the render button. If
you use these setting you mouse will have some serious lag time to
it. Be patience. It is recommended that for long rendering time you
use these setting and let the computer run over nighttime. Your PC
will be happy with you if you just leave it alone and let it due its
job.
-
Once the animation is done go open up the folder where you had
the 4565_Engine.pov and you will notice that it now was 30 new files
called 4565_E01.png through 4565_E30.png. These are our animation
files that correspond to storyboard 2! Create a sub-folder in the
animation folder and call it StoryBoard_2 and move all the .png
files into that folder.
-
Now we will create the images for storyboard 3. This will be
an easy one since the 150 images that we need are all the same. The
train engine is NOT moving so there is no need to create 150 images
just 1. In Step 4, we will tell Ulead MediaStudio Pro 6.0 that this
image will have a 5 second time to it as oppose to the rest that
will have 1/30th of a second (30 frames or images per second). There
is no need to render these images as the last image of storyboard_2
is the image in question. Create a new sub-folder in the animation
folder and call it Storyboard_3. Look in the storyboard_2 folder for
the 4565_E30.png file and copy it to the storyboard_3 folder. Rename
the file to 4565_SB_3.png
-
Now we need to complete the images for storyboard 4. This one
is similar to storyboard 2 in that it requires 90 frames. We need to
edit the 4565_Engine.ini file for this rendering. Everything will
stay the same with the exception of the clock variable. Instead of
starting at –750 and ending at 0. We need to start at 0 and end at
750. Thus Initial_Clock = 0 and Final_Clock = 750. Okay now
rendering the 4565_Engine.pov file.
-
When done rendering create a new sub-folder called
storyboard_4 and move the newly created images 4565_E01.png through
4565_E30.png to the folder. Now it’s time for some film production.