
POV is a freeware ray-tracing based language. Its purpose is to create beautiful images based on a technique which consist in sending rays into a 3D world and calculating a scene from the number of rays, the angles at which they intersect with other objects, the probability of a ray being reflected from an object, etc. This language is really incredible, and combining its strength with Maple strength is even more exciting. In this section we are only going to introduce this language, a complete description in here would be impossible as the official documentation takes about 300 pages, but this introduction should be enough to understand the basics for designing simple scenes and analyzing the POV files created out of the Maple program. For the complete documentation, and some live examples of POV art creation, you can go to : http://www.povray.org/
As usual, in order to learn a language we look at an example and learn from it. The following example is one of the first images I did, which I like a lot and is very easy to understand:
/* Mars Observatory *
* By Itamar Faybish */
#version 3
global_settings
{
assumed_gamma 1.8
}
#include "colors.inc"
#include "textures.inc"
camera
{
location <0.0,0.0,-15>
look_at <0.0,0.0,0.0>
}
light_source {
<0, 2.5, -7>
color White
spotlight
radius 15
falloff 20
tightness 10
point_at <0, 2.5, -3.5>
}
light_source
{
0*x // light's position (translated below)
color red 1.0 green 1.0 blue 1.0 // light's color
translate <-15, 40, -30>
}
plane
{
y, -1
pigment {
hexagon pigment { Jade },
pigment { White_Marble },
pigment { Jade }}
normal { bumps 0.4 scale 0.2 }
}
sky_sphere
{
pigment
{
gradient y
color_map { [0.0 color blue 0.9] [1.0 color rgb 1] }
}
}
union {
difference{
sphere { 0.0, 5 texture {pigment {radial frequency 2} finish{specular 0.4}}}
box { <-5,-5,-5>,<5,0,5> }
box { <-0.5,2,-6>,<0.5,3,0> texture {pigment{color White}}
}
}
sphere { < 5,-1,0>,1.2 texture {pigment {color BrightGold }}}
sphere { < -5,-1,0>,1.2 texture {pigment {color BrightGold}}}
sphere { < 5,-1,0>,1.2 texture {pigment {color BrightGold}}}
sphere { < 0,-1,5>,1.2 texture {pigment {color BrightGold}}}
sphere { < 0,-1,-5>,1 texture {pigment {color BrightGold}}}
cylinder { <0.5,3,-4>,<0.5,2,-4>, 0.1 open pigment{color White} }
cylinder { <-0.50,3,-4>,<-0.50,2,-4>, 0.1 open pigment{color White} }
cylinder { <0.5,3,-4>,<-0.5,3,-4>, 0.1 open pigment{color White} }
box { <-0.5,0.5,-4.5>,<0.5,0,-3> texture {pigment{color White}} rotate <45,0,0>}
cylinder { <0.5,2.0,-4>,<-0.5,2.0,-4>, 0.1 open pigment{color White} }
cylinder { <0.0,5.0,0.0>,<0,7.0,0>, 0.1 open pigment{color White} }
sphere { < 0,7,0>,0.4 texture {pigment {color BrightGold}}}
}
The resulting image is:

First we define which version of POV we are using, then comes a function global_settings. This function defines many variables which would be global to all the program, here we assign to the variable assumed_gamma the value 1.8 . This variable is used to correct the brightness of pixels on different monitors. Many machines do not have the same gamma monitor value and therefore have to be corrected. For examples for PC, an assumed_gamma of 1.8 is ok, whereas for MAC, 2.2 should be used. Remark the syntax of a function, first comes the name, and then comes open brackets, something, closing brackets.
Then comes the includes files. These files will just be inserted in there, just like in C. Here, colors.inc defines many predefined colors, and textures.inc many predefined textures.
After that we have the camera function. This defines where we want to put the camera. One very important thing is that POV is using a left-handed coordinate system, and therefore the following convention applies: the x axis is going positive to the right, the y axis is going positive to the sky, and the z axis is going positive inside the scene. So in the camera function we see that there is a location <0.0,0.0,-15>. This tells POV to put the camera 0 units right, 0 units up and ñ15 units back. Then we have the look_at <0.0,0.0,0.0> which tells POV that the camera should be pointing at 0 units right, 0 units up and 0 units in. In this camera function there exist also two other variables, namely up and right which defines the viewing area. For example up <0, 1, 0> and right <4/3, 0, 0> will define a 1 up to 4/3 right ration, like a TV.
After having placed the camera, we have to give some light to our scene or it would be all dark. This is done with the light_source function. There are many kinds of light_source, in the example above we used 2 types, namely a spotlight and a normal light. The normal light is the second one. It starts by saying where we want to put it. 0*x is similar to <0,0,0>, x, y, z are unit vectors in POV used to simplify the readings of position. For example, 2*x would mean <2,0,0>. After that we define the color of the light, this is done by writing color followed by the RGB values wanted, we could also have used a name like Yellow, White, etc. note that all colors start with a capital. Then we translate this light source using the translate primitive. In here we translate it ñ15 units to the right(which means 15 to the left), 40 units above and ñ30 units in. Let's examine the other kind of light_source. In here we first tell POV where to place the light source, then which color we want it to be, then we specify that it is a spotlight, and then come radius, falloff and tightness. These three defines how sharp and big the spotlight is, it is like when Celine Dion is moving on a concert scene, there is a spotlight following here. If we would place particles in the scene, we could see that this light_source is like emitting a conic like light, the more the radius, the more area its base area would be, this area will take a uniform color, whereas after that, it will diminish according to the parameter tightness, until reaching the limit radius which is defined by falloff. And finally we define where we want the light to look at.
Now let's pass to the plane function. This function draws an infinite plane. In this case it will draw a plane at <0,-1,0>. The pigment is the textures to give to this plane, in this case we used the hexagon primitive to draw, well, an hexagon like pattern. For this we have to give three textures, so two of them are given the Jade texture, and the third one is given the White_Marble texture. There are many other types of patterns, one which comes quite often is the checker primitive, it draws a checker with two colors.One things not to forget is that it is a pattern, and so, it is repeated to infinite. After the hexagon primitive, there is another primitive, namely normal. This define a unit vector normal to the plane in every point. So here we add some bumps to the plane, that is it will add an illusion of bumps to the plane, and then scale the bumps.
Then we come to the sky_sphere function. What it does is to define a very large sphere on which we could work on. Here we define a sphere having a texture on which color diminish according to the y axis, this is done with the primitive gradient y. Then we give it a color_map, which means that if we consider a specific region of the sphere, starting from a blue color, it will gradually change into white color at the end. the 0.9 after the blue keyword means that we specify a color which is 90% of full intensity.
Next we come to the heart of the entire thing. That is the creation of objects. First let's see what union and difference do. Union is used to unite different objects together. This may seems not necessary, itís enough to just define all the objects one after the other, but the problems with this is that, what if we want to rotate all the objects together? In this case we have to use union on all of them, and then we can use the translate, used to translate an object by certain <x, y, z> units, rotate, used to rotate an object by certain amounts in relation to any axis or scale, used to scale an object by a certain amount for any axis, on the entire form. The difference is used to cut from an object whatever we do not wish to be; the first object defined is the base object, the one wanted to be drawn, and all the others are the ones want to subtract from the base object. In the example above, we can see that we do a difference of a base object which is a sphere with two boxes. This will define a half-sphere with a hole for the window. This difference is united to many different objects which will make the final result.
Now let's go to the definitions of objects. Let's start with the sphere. Inside the sphere function, we have to first give the center, note that here we used the simple expression 0, which will be changed to <0,0,0>, then come the radius of the sphere. So if for example we wanted a sphere centered at <1,2,1> with radius 4 we would have used: sphere {<1,2,1>,4 Ö }, where Ö is the texture to be used. So after having defined the radius, we must give it a certain texture, this is done with the texture primitive, followed by the pigment primitive, followed by the actual pigment wanted. In the texture primitive there is another primitive called finish which defines the final texture brightness, how much light it reflect, how much it refract, and many more. For example two of its own primitives are ambient and diffuse. The first one is used to give a constant lightning to the object, that means if we give it a value of 1 then it is emitting at full power and this object would shining like the sun even tough there may be no light_source there an ambient of 0.4 is default; the diffuse primitive is used to say how much of the light rays coming on the object will be reflected back.
The other objects used here are box, which draws a box where we must give two opposing corners, the cylinder object which draws a cylinder given the coordinate of the two ends and a radius. Note that the texture part is the same for any object, that means that if we master the texture parts, it would be used very often.
Now let's pass to the actual programming in POV. In POV we can define variables, this is done with the #declare var=something. We have basically three general types of variables, float, string and vectors. The if statement gooiest like this :
#if var=something1
something2
#else
something3
#end
The while statement goes like this:
#while var=something1
something2
#end
Let's pass now to an exciting new realm, the realm of animation. There are many programs available that will take a series of still TGA and transform them into an animation, we will see some of them later. So how is this animation working? let's look at an example
// This fill takes the name : test.pov
#include "colors.inc"
camera {
location <0, 3, -6>
look_at <0, 0, 0>
}
light_source { <20, 20, -20> color White }
plane { y, 0
pigment { checker color White color Black }
}
sphere { <0, 0, 0> , 1
pigment {
gradient x
color_map {
[0.0 Blue ]
[0.5 Blue ]
[0.5 White ]
[1.0 White ]
}
scale .25
}
rotate <0, 0, clock*360>
}
In this example, the only thing we did not see so far is the clock variable. This is the key to it all. In another ini file, we would say something like this:
Input_File_Name=test.pov
Initial_Clock = 0.0
Final_Clock = 1.0
Initial_Frame = 1
Final_Frame = 20
This is saying that when the clock is running from 0 to 1, it should do it in 20 frames, so the clock is incremented at the rate of 1/20. In the example above, it will make the sphere rotate once around itís z axis and create 20 TGA files which could be converted into an animation file by special utilities.
The last thing to note is how to comment. This is like C++, simple use // in the beginning of a line for a one line comment, or use /* and */ for a paragraph comment.
With this we end our introductory study to the POV language. I insist on the fact that it is only an introduction and I encourage you a lot to continue youíre study of it using the official documentation. I hope youíre exploration will bring you some pleasing "artist" feelings.