The Online POV-Ray Tutorial

Introduction to POV-Ray and Ray-tracing

(Show Jump Points) (Hide Jump Points)

In this section, you will learn what ray-tracing is, how it works, what POV-Ray is, and how POV-Ray relates to the rest of the ray-tracing world. This is a good section if you've never experimented with (or even heard of) ray-tracing before.

Quick index:

  1. What is ray-tracing?
  2. How does ray-tracing work?
  3. What is POV-Ray?
  4. How do I set up POV-Ray?


What is ray-tracing?

Ray-tracing is a method of creating visual art in which a description of an object or scene is mathematically converted into a picture. In more precise terms, ray-tracing is the process of mathematically generating near-photorealistic images from a given description of a scene via geometrical modeling of light rays.

Ray-tracing can generate very beautiful and complex scenes, and can open exciting possibilities as a new method of creating visual art. One of the most important advantages of computer-based ray-tracing over more "orthodox" art forms is that it removes the need for technical skills (such as the ability to paint, draw, or sculpt) that may take years to master, and places the burden on the computer. This leaves the user to be as creative as possible, without having to spend years learning difficult skills. In fact, you should be well on your way to creating some exciting pictures before you're far along this tutorial.

Ray-tracing can require millions and even billions of complex mathematical calculations and, as such, is usually done by computer (and even then, is not a speedy process). Usually, in the computer-based ray-tracing procedure, a file containing the description of a scene (in terms that the ray-tracing software can understand, and usually in some human-readable format) is converted, by the computer, into an actual image of the scene. Later on in the tutorial you will learn how to use the POV-Ray software to create scenes of your own, with the help of your computer.

Of course, ray-tracing is not a magical technique that makes all art easy. Certain types of scenes are difficult or impossible to create with ray-tracing software. In most cases, you will find that ray-tracing is good at generating mathematically simple objects, such as those composed of spheres, cones and cubes, and poor (slower or more difficult to describe) at generating more complex objects, like a human face. There are several ways of getting around these barriers, but ray-tracing, like all forms of art, does have certain inherent limitations.

Because ray-tracing is based on math, ray-traced scenes have some distinct characteristics. For example, in a simple ray-traced scene, all objects are in focus, and all shadows are crisp and well-defined; in fact, every object in the scene is mathematically perfect. (When was the last time you saw a mathematically perfect pear?) Because of this, images produced by ray-tracing tend to look slightly odd, or even surrealistic, a side-effect many artists can exploit to their benefit. It is, interestingly enough, considered a mark of a "true ray-tracing artist" to be able to create more realistic, "less perfect" scenes.


How does ray-tracing work?

We won't go into all the gory details, but having a general understanding of what's going on behind the scenes (so to speak) can be helpful when you start ray-tracing your own images. Although there are several methods of ray-tracing, one of the most common (and the one the POV-Ray software package uses) works something like this:

First, an internal model of the scene is generated, with your computer screen included as the receiving "eye" in the model. Then, the software traces imaginary light rays backwards from where their endpoint lies (a pixel on your computer screen) to their initial point (some light source in the scene). This step is repeated, pixel by pixel, until the entire image has been created.

The reason the software traces the light rays backwards, instead of starting at the light source, is for efficiency's sake -- if a light ray doesn't end up on your screen, then you, as the user, don't care about it (because you'll never see it). By tracing the light rays backwards, beginning at the computer screen, the software can assure that every light ray it calculates is one you care about, because it knows that it will end up on your screen.

In their journey, the light rays can be reflected by mirrors, refracted by glass, or undergo various other contortions, all of which result in a single pixel of the final image. Because the ray-tracing software must trace one ray of light for each pixel in the output image, and because the light rays can undergo so many contortions, the process of ray-tracing can take a very long time, depending on the size and complexity of the image and the processing power of your computer. Unless you have an extraordinarily fast computer, you will most likely find yourself waiting around impatiently for your scene to finish rendering once you've begun to ray-trace in earnest.


What is POV-Ray?

POV-Ray is a high-quality, freely available ray-tracing software package that is available for PC, Macintosh and UNIX platforms. Yes, that's right, it's free! If you're a programmer interested in POV-Ray, you can also pick up a copy of the source code without charge. POV-Ray is perhaps one of the most commonly used ray-tracing software to date, because of its relative ease of use, cheap price, and high quality.

POV-Ray is no toy. Despite not generating any direct income from their POV-Ray software, the POV-Ray Team (the people responsible for POV-Ray) has managed to create a commercial-quality product and, in the true spirit of the Internet, distribute it widely and without charge. As a consequence, POV-Ray is one of the most popular ray-tracing programs to date. We, the authors of the Tutorial, think that POV-Ray is one of the greatest things to come out of the Internet (gee, is it a little obvious?), which is why we decided to create this Web page.

At any rate, POV-Ray is what is known as a "rendering engine". What this means is that POV-Ray will take a file as input and generate an output file, but does not have much in the way of interface. There are modellers available for POV-Ray that will do that kind of visualization for you, if you choose, but we recommend you only start using those tools once you have a firm grasp of the POV-Ray language. Otherwise, you'll get stuck down the road.

Describing scenes to POV-Ray is fairly simple. You give POV-Ray a file containing a description of every object in the scene, written in the POV-Ray language (which you will learn later in the tutorial). Each object's description consists of:

  1. What type of object you want (one of POV-Ray's simple objects or one you've created yourself); and
  2. Various attributes of the object (its color, how it reflects light, etc).
POV-Ray takes this file and generates a picture, which you can then view.

The Path of Learning is not meant to cover every single detail of the POV-Ray language. Such a task would be tremendous (although the Language Reference has come very close). Instead the Path will guide you as you learn about each section, and, when appropriate, refer you to more complete sources of information. At the end of the Path, you should be well on your way to being a certified POV-Ray blackbelt.


How do I set up POV-Ray?

The latest version of POV-Ray can always be found at ftp.povray.org. You will have to download the correct version for your computer (there are versions available for most operating systems) and to set it up.

Once you have POV-Ray, how you set it up is highly dependant on your operating system. We're not about to teach you how to use your own computer; if you can't set it up yourself, ask a local computer guru to help.

As we mentioned above, POV-Ray doesn't have much of an interface; on most operating systems, you will give POV-Ray the name of your input file, the name of your output file, and a whole bunch of other options via the command line. You will also need some form of image viewer and/or converter in order to display the output files that POV-Ray creates; again, this is highly operating-system-dependant.

POV-Ray also comes with documentation and example scenes; these make excellent references if you're stuck or need to know more.

Ok, we're ready to start learning the real stuff now!


Top of Document Main Page Step 2: POV-Ray Basics

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team