Your most basic scenes will consist of a light source, a camera, and an object. Raytracers such as POV-Ray work by sending “rays” from the camera and following the “rays” through reflection, refraction, and absorption until the rays reach a light source or are lost in shadow. See http://en.wikipedia.org/wiki/Raytracing for a more detailed explanation of what raytracing is. Now, let’s create our first simple scene.
You should have already download POV-Ray for your computer, and started it up. You will most likely have a blank document waiting for you to type your scene description. Scene descriptions in POV-Ray use a very formal “scene description language”. I’ll be using POV-Ray 3.6.1 for Mac OS X in the examples here. The location of menus and menu items will probably be slightly different if you are not using Mac OS X, but the scene description text will be exactly the same no matter what platform you are using.
Just about everything you put into a POV-Ray scene has to have a location. POV-Ray requires you to specify three numbers for each location. These numbers are the distance from an imaginary “origin” which might be thought of as the center of the universe.
A location of “5, 3, 6”, for example, would be a distance of five to the right of the center, a distance of three above the center, and a distance of six behind the center.
If you need to place something to the left of center, below the center, or in front of the center, you’ll use negative numbers: “-3, -9, -6”, for example.
What do those numbers mean in actual distance? It’s an important question, and one you’ll want to think about before you start placing things in your scene. You can decide that the numbers mean meters, feet, inches, miles, or even light-years. I always try to place a note at the top of my scenes reminding me of what the numbers mean.
Because you can move the camera wherever you want, the “center of the universe” is usually not the center of your image.
We need a light, a camera, and an object. Let’s do the light first. The first line of our scene will be our reminder about what the numbers for locations mean. Let’s go with meters. If you don’t have an open blank document in POV-Ray, pull down the “File” menu and choose “New”.
//units are in meters
Reminders and notes can be placed anywhere in your text, but must begin with two slashes. The two slashes tell POV-Ray that this line is not an instruction for it to place something within the scene.

You will usually want to put a note or reminder in front of every object, to remind of what their purpose is later.
Our light source is going to need a location and a color. You can have green lights, blue lights, chartreuse lights, if you want. Often, you’ll be using white lights. Colors in POV-Ray are usually specified with specific amounts of red, green, and blue.
//one light source
light_source {
<20, 35, -2>
color rgb <1, 1, 1>
}
This is how most objects in your scene will look in your text. The first line tells POV-Ray what kind of an object it is, followed by an open curly-bracket. The rest of the lines, down to the matching closing curly-bracket, describe that object. Our light source has two lines in its description. The first line is its location, and the second line is its color.
Locations are surrounded by less-than and greater-than symbols. This light source is 20 meters to the right, 35 meters up, and 2 meters towards us.
Because colors are specified using three numbers also, they often will look like locations. Here, we are saying that our color in RGB format is 1 for red, 1 for green, and 1 for blue. Colors range from 0 to 1, so these are the maximum numbers for all three colors. If you remember your color mixes, this makes the color white.
You can have many light sources in your scene, each in different locations, with different colors, and different intensities. The more light sources you have, the longer it will take for POV-Ray to create an image from your scene description.
Light sources cast light on the scene, but they are not themselves visible to the camera.
Our camera looks a lot like our light source.
//camera is at eye-level
camera {
location <0, 2, -10>
look_at <0, 0, 0>
}
This camera is two meters up and ten meters back. The camera is pointed straight towards the center of the universe: in the “look_at” location, each location number is zero.
While you can have many light sources in your scene, you can have only one camera.
Now comes the moment of truth. We’re going to put something in our scene. At the center of the universe, we’re going to put a big sphere.
//the center of the universe
sphere {
<0, 0, 0>
2
pigment {
color rgb <.2, .6, .8>
}
}
This sphere is at location <0, 0, 0>, which is the center of POV-Ray’s universe. The next number, 2, is the radius of this sphere.
After that, we have a pigment section. A pigment section begins and ends with curly-brackets, just like objects do. Pigments can be quite complex, but in this case we’re just setting the color of the object’s pigment. The red is .2 (or 20% of maximum), the green is .6 (or 60% of maximum) and the blue is .8 (80% of maximum). This makes for a light blue.
Your scene should now have all three sections: lights, camera, and object.
//units are in meters
//one light source
light_source {
<20, 35, -2>
color rgb <1, 1, 1>
}
//camera is at eye-level
camera {
location <0, 2, -10>
look_at <0, 0, 0>
}
//the center of the universe
sphere {
<0, 0, 0>
2
pigment {
color rgb <.2, .6, .8>
}
}
It is time to render it so that we can see what it looks like. When POV-Ray renders an image, it uses raytracing to convert the text scene description into an image.
First, you need to save the document. POV-Ray will not render the file unless it is saved first. After you save it the first time, POV-Ray will automatically save it every time you re-render it.
We’re rendering an image of a big sphere, so call it something like “Big Sphere.pov”. You usually want your scene files to end in .pov so that POV-Ray will recognize that it owns those files.
After saving the scene, you can pull down the “Render” menu and choose “Render”. POV-Ray will render your scene to an image file. Depending on your settings, it may also display a preview of the image on your display as it renders.
By default, POV-Ray places the image file in the same directory as the text scene file.
What we end up with is a blue sphere, with a light source up and to the right, against a black background.

You have several settings for what POV-Ray does while it renders. On Mac OS X, you can find the settings for your scene under the “Edit” menu. There are three important sections to the settings: the Scene, Quality, and Output panes.

In the Scene pane, you’ll almost always want to have Show Preview checked. For scenes that take a long time to render, you might find Mosaic Display useful while testing the image. This renders the image in progressively smaller chunks, making it sort of “fade in” as it renders. This allows you to see potential mistakes without having to wait for the entire scene to render. Some complex scenes can take hours! None of the ones we’ll be working with here should take more than a few minutes, however.

The Quality pane lets you specify the quality of your final image. If you reduce the quality, the render takes less time. Usually you will want to leave Render Quality at the maximum. When you reduce the quality you are actually removing information from the final image. Depending on the render quality, you may lose shadows, reflections, and even textures. A reduced-quality image often will not show you what you need to see to know whether your scene description is correct.
Anti-Aliasing smooths out the edges of your objects. More specifically, it smooths out the edges of any adjacent colors. Anti-aliasing almost always makes the resulting image look nicer. It makes the render take more time, however, so I will often leave anti-aliasing off until I’m finished. I’ll do the final render with anti-aliasing turned on.
Here’s a close-up of our blue sphere, with anti-aliasing turned off and anti-aliasing turned on. Notice the “staircase” effect on upper part of the left image.

The more sharp transitions from one color to another, the more you’ll need anti-aliasing for your final render. Anti-aliasing and mosaic preview do not work well together, so when you do your final, anti-aliased render you’ll want to turn mosaic preview off.

In the Output pane, you’ll set the size of the image, the kind of the image, and whether or not to add an alpha channel. I’ve been rendering this image at 640 by 480.
I prefer to save my rendered images as PNG, because it is a fairly universal format. From PNG, I can use image software such as GraphicConverter, GIMP, or Photoshop to convert the image to JPEG, GIF, or compressed PNG as needed. But I keep the original POV-Ray PNG so that I don’t have to re-render to get a higher quality image.
The alpha channel is very useful for creating web images and for merging POV-Ray images into photographs. Turning on the alpha channel makes the image transparent where nothing exists. In our current image, there is only one object, the sphere. If we turned the alpha channel on, every other part of the image would be transparent. This makes the image useful as, say, a button or icon on a web page. If your page is white and you put the blue sphere there, it will appear as a blue sphere on a white background: the black is transparent because nothing is there. The alpha channel is especially useful for anti-aliased images. In an anti-aliased image, the smoothed sections will have varying degrees of transparency, removing the halo effect you often see when trying to match smoothed images to a web page’s background color.
I hope I haven’t scared you with all these numbers because, at least for some of them, there is an easier way. POV-Ray comes with several files that contain useful objects and numbers. One of those files will let you specify your colors in English rather than as a series of red, green, and blue numbers.
In order to use this color file, you have to “include” it. In order to include it, you need to make sure that POV-Ray knows where your include files are. Under the “Edit” menu, choose “Preferences...”.

You want to add to the Global Include Paths. In your POV-Ray folder, there will be a folder called “include”. Click on the “Add...” button and choose that folder. Its path will appear in the Global Include Paths box.

Once you’ve told POV-Ray where to find your include files, we can use color names instead of RGB numbers in our scene. First, tell POV-Ray to include the “colors” file. Most include files will end in “.inc”.
//get some colors
#include "colors.inc"
Then, replace the color in the light_source:
//one light source
light_source {
<20, 35, -2>
color White
}
And the color in the sphere:
//the center of the universe
sphere {
<0, 0, 0>
2
pigment {
color SkyBlue
}
}
When you render this scene, it will look exactly as the other scene did.
You can mix RGB colors and color names throughout your scene as necessary.
There are two basic kinds of objects in POV-Ray: objects that have a definite end, and objects that go on forever. POV-Ray calls these finite objects and infinite objects. A sphere is a finite object. A plane is an infinite one. Let’s add a plane to our scene.
//it's Magrathea!
plane {
y, 0
pigment {
color Gold
}
}
Render this one and you’ve got half of a sphere protruding from a golden plane. A plane goes on forever in two directions. This plane goes on forever left and right, and forward and back. You specify which directions it goes on forever by telling POV-Ray which direction it does not go on forever.
Rather than using left, right, up, down, forward, and back, POV-Ray uses x, y, and z as its directions. What we’ve been calling left and right is ‘x’. What we’ve been calling up and down is ‘y’, and what we’ve been calling forward and back is ‘z’. From now on, we’re going to use x, y, and z as well. Left, right, up, down, forward, and back don’t make much sense when we start moving the camera around.
The center of the universe is zero x, zero y, and zero z.
When we tell POV that our plane is “y, 0”, we are saying that the y axis is perpendicular to the plane. And the plane is zero units away from y’s origin (or, zero units away from zero y).

Where planes go on to infinity in two directions, they are infinitely thin in the other direction. Temporarily change your camera’s location from a y of 2, to a y of 0:
//camera is at eye-level
camera {
location <0, 0, -10>
look_at <0, 0, 0>
}

The plane disappears completely! All you can see now is the shadow that it casts on the lower half of the sphere. This is because the plane is infinitely thin, and we are looking at the plane straight on. If we were even slightly above it or slightly below it, we would see the plane, but we’re not. Go ahead and try a ‘y’ location of .0001 or -.0001 for the camera and see what happens. In both cases, you’ll seen the plane and either the top or bottom half of the sphere.
Before going further, restore the camera’s y to 2 and re-render it to make sure it is still half of a blue sphere on a gold plane.
If you’ve been paying attention to the description of raytracing, you might be asking why the plane casts a shadow onto a visible sphere. The light source is above the plane. The plane goes on to infinity in the x and z directions. How does any light get below the plane? We shouldn’t be able to see the lower half of the sphere at all.
The reason it does show up is that POV-Ray assumes by default that there is “ambient light” throughout the scene. You can control this. There are two places to set the ambient light.
First, you have the global ambient. Add the following to the top of your scene:
global_settings {
ambient_light Black
}
This sets the general ambient light to zero. If you render the scene with the ambient light set to zero, the shadows will all become much sharper. If you change the camera’s location to below the plane, the whole scene will become black. That’s because there is no ambient light, and the one light source can’t illuminate below the plane.
By default, ambient_light is White. Often, you’ll set it to white, black, or some gray in-between. You can get some interesting effects by changing its color to something else, however. Go ahead and change it to Yellow in this scene and re-render it.

Notice how the shadows on the blue sphere have a yellowish tint? That’s from the ambient light.