1.0 Introduction
1.1 About POV-Ray
1.2 About Animay
1.3 Other Utilities
1.3.1 Viewers
1.3.2 Animators
2.0 Installing Animay
2.1 animay.h
2.2 Makefile
3.0 Creating an Animation
3.1 The Animay File
3.2 Tutorial
3.2.1 Creating the Scene
3.2.2 The Animation Data
3.2.3 Spline Images
3.2.4 Frame Images
4.0 Wielding Animay
4.1 Command Line Parameters
4.2 Other Ways of Setting Parameters
5.0 Glossary of Terms
The first section gives an introduction to POVray and Animay, and some other graphics utilities which help in the creation of animations.
The second section details how to install Animay, for both the standard version and the Motif version.
Section three describes the format of the Animay data files, and gives a brief tutorial on designing animations.
Section four specifies all the command line options, and the use of Animay to create an animation, and how to generate animations using other peoples Animay files.
The use of the Motif previewer and editor is covered in a separate document entitled "Animay Motif Editor".
A scene is created by describing the elements which make up the scene in a text file. Elements can be objects such as spheres, planes, cubes, pyramids, cylinders, etc, all of which can have different textures. The scene can also have different sources of light (at least one light source helps). POVray then takes the scene you have described and creates an image file of the scene. To do this, the scene also contains details about a "camera". The camera usually has a location, and a point it is focussed on, but may also have other features, such as a different field of view angle, a different "up vector", and so on.
You will need to install POVray on your system to generate animations with Animay. POVray may be downloaded from the Internet by anonymous FTP from the following sites :
alfred.ccs.carleton.ca:/pub/pov-ray
ftp.povray.org:/pub/povray
uniwa.uwa.edu.au:/pub/povray
Animay uses a slightly different format of data file to POVray, which are usually
given the extension ".anp". These files are the same as POVray's ".pov" files,
but also contain an "animation" block which details information on how to animate
the scene. The values within the POVray file which are to change in the animation
are also replaced by variables (represented by $
Animay has two modes of operation. The first is in command line mode, where any options
are specified when Animay is run, and Animay goes ahead and generates the frames.
The second mode consists of a previewer and editor, which uses X-windows graphics and
the Motif widget set. As a result, the preview/edit mode can only be used on a Unix
workstation with both X-windows and the Motif widget set. The command line mode
requires no graphics or other machine dependent features, though, and so should
work on most platforms that POVray works on. The command line mode generates the
same animation as the preview mode, but all editing must be done manually.
One of the most widely used viewers for X-windows is "xv". Unfortunately, POVray
generates targa files when used with Animay, and "xv" and some other viewers will
not display targa files. To get around this, there is a small converter called
"tga2gif" available at most POVray sites, which converts Targa files to the more
common GIF format. Another set of utilities called "ImageMagick" contains a
utility called "display" which can display Targa format images. It also contains
a utility called "convert" which, suprisingly enough, can convert Targa images
to a large number of different formats.
The standard version should compile on most platforms without any problems. If you
have any troubles, send me some E-mail describing the problem and I'll try and fix
it.
The Motif version has only been tested on HP300/400's and HP700's under HPUX's VUE,
and Silicon Graphic's Iris and Indy systems, but should work fine with most unix
systems with the Motif libraries. Once again, if you have any troubles,
send me some E-mail describing the problem, and I'll try and fix it.
A tutorial will then be given, showing the steps to creating an
animation from scratch.
The animation requires two changes to a scene file :
The first change involves embedding variable names
within the standard scene data. For each value you want to animate, replace
this with a variable name, preceeded by a "$" symbol. For example, if you had
an object which you wanted to animate up and down the Y axis, then the
translation vector may look something like <10.0, $myobjy, 3.5>.
The second changes involves adding a new structure to the file. This structure
has the format :
Only two of frames, duration and period is required, as the third can be
calculated by the first two. If all three are specified, the period given
is ignored and recalculated to fit the duration and frames values.
Each variable name corresponds to a variable name embedded in the scene part
of the file. For example, for our object with translation vector <10.0, $myobj, 3.5>,
our animation block may look something like this :
When Animay goes to generate the animation, it calculates a value at each frame time,
based on the specified keyframes. It does this by calculating a natural interpolation
between the points. The resultant pathway is usually a smooth curve, known as a
spline curve.
The spline curve of each variable may be previewed by running Animay with the -p
command line option. For the Motif version of Animay this will enter edit mode,
and display the splines in a window. For the standard version, a simple text
bar graph will be printed, giving a rough idea on what the spline looks like.
The camera will circle around the sphere twice. To do this, we add a keyframe
each 1/4 of a circle for the "camx" and "camz" variables. The resultant spline
are close to sine waves, with one offset from the other by 90 degrees.
The height of the camera will alter to give a varying perspective of the
sphere and planes. It will initially be high, will dip down slowly, then
rise rapidly to finish at the same height.
Lastly, the sphere will start near the bottom plane, rise to the top plane, and
return to the bottom plane.
As all variables finish at the same value they start, the animation may be played
cyclically. The effect is as if the sphere is slowly bouncing on the lower plane,
and almost hitting the higher plane at the peak of its arc.
The complete animation block is now :
An mpeg of the demo may be retrieved by anonymous FTP from
guri.cage.curtin.edu.au:/pub/animay/animay.demo.mpg
1.3 Other Utilities
Although POVray is the only other essential tool for creating animations, there
are a number of other utilities which may be helpful.
1.3.1 Viewers
It's helpful to have a picture viewer, to preview what individual frames are like.
If configured correctly, Animay (in preview mode) can generate, then display a
frame at a specified time. It does this by first running POVray with the correct
data, then running the viewer you specify. Even when using Animay on other systems,
it is helpful to look at different frames to get some idea of the final animation.
1.3.2 Animators
Also of great importance is some software to compile each frame image, and
display them one after the other to generate the final animation. There are
two types of utilities to help with this. The first reads in all frames, which
are stored in individual files, and then displays them one after another. An
example of this is the "animate" utility, which is also a part of the
"ImageMagick" set of programs. The second type of utility consists of an
encoder, which assembles all the frames into one animation file, and a
decoder, which plays back the animation. An example animation format
is the "mpeg" format. Using "mpeg_encode", all the frames can be compressed
and compiled into one ".mpg" file. Using "mpeg_play" this file can then
be played back. Other animation formats include ".fli", ".gl", and ".anm".
2.0 Installing Animay
There are a few files you will need to edit before
compiling Animay. These contain specific things about where
things are installed on your system, and what system you are using.
These are specified in the files animay.h, and Makefile.
2.1 animay.h
This file contains a number of defines
which tell Animay what utilities to use, where they are, plus
a few default options. Just change whatever defines you need to
what you need. The format of a define is :
#define
#define WHEREAMI "Antarctica"
You should not need to alter anything else in animay.h.
MOSAIC_CMD
POV_CMD
DISPLAY_CMD
DISPLAY_CMD_POST
DEF_OUT_FILE
ENV_VAR_NAME
2.2 Makefile
This file controls how Animay is built and linked, and will therefore control
whether or not the Motif version is compiled. There are two Makefiles supplied,
called "Makefile.std" and "Makefile.Motif". If you want just the standard version
of Animay, copy "Makefile.std" to "Makefile". If you want the Motif preview/edit version,
copy "Makefile.Motif" to "Makefile".
3.0 Creating an Animation
This section will show how to create animation files (files of this type
usually with the extension ".anp"). It hilights the differences between an
Animay file and a POVray file, and shows how to animate a POVray scene
by modifying an existing POVray file.
3.1 The Animay File
The animation files Animay uses (which usually have the extension ".anp") are
the same as POVray's files, except with extra information concerning how to
animate the scene.
Where each quote in []'s is replaced by a value, be it numerical, or
a variable name.
animation
{ frames [number of frames]
duration [total duration of animation]
period [time between each frame]
keyframes
{ [variable name 1]
{ [time 1], [value at time 1],
[time 2], [value at time 2],
:
:
}
[variable name 2]
{ [time 1], [value at time 1],
:
:
}
:
:
}
}
Note that in the animation block the variable name is not preceeded by a "$".
The keyframe values are times and values which you want to occur. In other words,
you want the value of the variable to be "X" at time "T". Animations must consist
of at least two keyframes, and it is typical to place a keyframe at time 0 (the
start of the animation) and at the end of the animation.
animation
{ frames 200
duration 5
keyframes
{ myobj
{ 0.0, 0.0,
1.0, 5.0,
3.7, -3.2,
5.0, 7
}
}
}
3.2 Tutorial
3.2.1 Creating the Scene
Let's take a simple example POVray scene, and animate it. First,
a checkered plane, with a wood sphere above it (If you are new to
creating scenes with POVray, refer to the POVray documentation).
We want to animate the sphere along the Y axis, so let's replace
the sphere's Y co-ordinate with the variable "spherey" :
Since our sphere will be moving upwards, let's add another plane overhead to give it some
background when we're viewing it from below. Also, two light sources, opposite sides of the
sphere, and one near each plane :
plane
{ <0, 1, 0>, 0
pigment
{ checker
color Red
color Blue
}
}
sphere
{ <0, $spherey, 0>, 0.2
texture
{ pigment
{ DMFWood4
scale 4
}
finish {Shiny}
}
}
Lastly, we add our camera, which will always focus on the sphere, and which will
move along all three axis, so lets use variable names "camx", "camy" and "camz". :
plane
{ <0, -1, 0>, -3
pigment
{ checker
color Brown
color Green
}
}
light_source { <-5, 0.5, -2> color White}
light_source { <5, 2.5, 2> color White}
camera
{ location <$camx,$camy,$camz>
look_at <0,$spherey,0>
}
3.2.2 The Animation Data
Now that the scene is complete, we add the animation structure. Let's generate
200 frames, and set the duration to 2. The duration has no set units; it is just
a representation of how long the animation is relative to the time of each
keyframe.
The Animay file is now complete, and the frames for the animation can be
generated with a command similar to "animay -i demo.anp", where "demo.anp"
is a text file with this data in it.
animation
{ frames 200
duration 2
keyframes
{ camx
{ 0,0, 0.5,0,
1,0, 1.25,1,
1.5,0, 0.75,-1,
1.75,-1, 0.25,1,
2,0
}
camy
{ 0,2, 1.125,1.4,
1.4,2.5, 2,2
}
camz
{ 0,-1, 0.25,0,
0.5,1, 0.75,0,
1,-1, 1.25,0,
1.5,1, 1.75,0,
2,-1
}
spherey
{ 0,0, 1,3,
2,0
}
}
}
3.2.3 Spline Images
The following images show the spline curves of the four variables :
"camx"
"camy"
"camz"
"spherey"
3.2.4 Frame Images
The following images show frames 0, 90, and 140 of the resulting animation :
4.0 Wielding Animay
4.1 Command Line Parameters
At this stage there are only a few command line parameters for Animay,
but as planned features are installed, this will increase. What follows is a
list of the parameters, and an explanation as to their purpose.
-i 'filename'
-o 'filename'
If the filename specified ends
in a '/', then the string appended is 'frame###.tga', where ### is the frame
number. For example, if the parameter is '-o frames/', then frame 0 will be
saved as 'frames/frame000.tga'.
If the filename specified does not end in '/', then the string appended is
'###.tga', where ### is the frame number. For example, if the parameter is
'-o ahawb', then frame 0 will be saved as 'ahawb000.tga'.
-p
-e
4.2 Other Ways of Setting Parameters
Parameters may also be passed to Animay by setting an environment
variable. This is 'ANIMAYOPT' by default, but may be altered in "animay.h" if
so desired. By setting the environment variable, any frequently used options need
not be retyped. For example, you may be working on an animation from the file "scrolly.anp",
you want the frames written to the "scrollyframe" directory, and you always use the
Motif interface. To simplify things, you would set the ANIMAYOPT environment
variable to be "-i scrolly.anp -o scrollyframe/ -e".
5.0 Glossary of Terms
The following terms are used in reference within this document. The definitions
here are those relevant to this document, to help further understanding of the concepts
involved. If there are any terms anyone doesn't understand within this document, E-mail
me and I will include them in the glossary.
render
raytracing
define
The format of a define statement is :
#define
Trevor Phillips
phillips@guri.cage.curtin.edu.au