You are here

Creating Photo-realistic Images and Animations

Author(s): 
Michael Grady (Southern Utah Univ.)

5. Animating the Scene

The animation given in Part I of this paper has resolution 1280x720 pixels, and is 20 seconds long at 25 frames per second. This requires generating 500 high resolution frames of the object, each with a different rotation, and stitching the frames together. This process can take a significant amount of time, even on today's powerful desktop machines. In order to speed up the turn around time, we'll create a shorter animation at lower resolution. Let's start with a 10 second video at 320x180 resolution.

We can let POV-Ray automate frame generation by using a clock variable and indicating the start and end frames in the command line. The starting frame will be number 1 and the ending frame number 250. The clock variable starts at zero and increments 1/250 each frame. So the rotate command increments the rotation about the z axis 360/250 degrees between frames. Note that only two lines (the first and the last) have changed. Save this code as in a separate folder called “anim” since it directs POV-Ray to generate 250 images. Use the command given in the first line to render the 250 frames. By removing the   switch, there will be no pause between frames as they are generated. By including the   switch, the frames will not be displayed on the screen as they are generated, reducing overall computation time.

Mac users of Mega-POV can set the equivalent parameters under the “Clock Settings” tab in the Preferences window.

Windows users should click on the Tools tab followed by the “Edit resolution INI file” menu item. The following text should be added at the end of the file:

[320x180 anim, AA 0.3]
Width=320
Height=180
Antialias=On
Antialias_Threshold=0.3
Output_File_Type=N
Initial_Frame=1
Final_Frame=250

Save this file and restart POV-Ray. In the drop down text window on the upper left, select the resolution “[320x180 anim, AA 0.3]”. Save it as animate.pov and render it. (Changes from dodec-05.pov above are indicated in boldface.)

 

After a few minutes, all the frames will have rendered. Notice that they are conveniently named animate001.png through animate250.png. If you have ImageMagick installed on your computer, you can immediately watch the animation using the command

animate *.png

To generate a movie file in one of the usual formats, I strongly recommend using the open source audio/visual manipulation tool FFMpeg. It can be downloaded at ffmpeg.org The command for generating a video in quicktime format is

ffmpeg -sameq -r 25 -i animate%03d.png animate.mov

This directs ffmpeg to generate a movie in quicktime format (animate.mov) at the same quality as the images and at a rate of 25 frames per second (click on Figure 7 to run the animation).

dodecahedron with linked animation
Figure 7 with linked animation: Animating the scene

Michael Grady (Southern Utah Univ.), "Creating Photo-realistic Images and Animations," Convergence (September 2010), DOI:10.4169/loci003351