Contents
HomePage


[POV RAY]

By Adam Foster

Photo-realistic 3D graphics... on an Atari!

You have probably already seen some raytraced pictures, on the TV, in films, and so on. But surely this cannot be done on a humble Atari? But think again!

Probably the best, and cheapest, raytracing software for the Atari is the Persistence Of Vision Raytracer. This is available for many computers, from Acorn to Unix, and is also readily available for the Atari. The best thing about it is that it's freeware, in other words you can copy it, use it, and modify it at no extra cost! Another useful thing about it is that you can design your scene on your Atari, and render it at a huge resolution on a friend's PC.

But what about using it? POV-Ray does not have a user-friendly interface, in fact, it is hard to say whether it has an interface at all. It is controlled via a command line, and the scene files must be written in a special language, and saved as plain ASCII. This is not as bad as it sounds, and also makes it possible to create shells and design programs such as ED POV for the Atari, and MORAY for the PC. So, how do you get started?

First of all, write to your local PD library, asking for the POV executables, the documentation, and a few example scene files to get you started. If you have access to a modem, the programs are available on most bulletin boards, including 42BBS. Next, decompress them, and sort them out on a disk. A hard disk is recommended, but it should be possible to get by without one, if you're careful.

One of the first things to remember when using POV-Ray is how to use three dimensional coordinates. These probably sound very complex at first, but in reality they are very simple. Each position is held as three numbers, the x, y and z amounts. In POV these are expressed as <x, y, z>, where the letters represent the numbers you would use. POV, as default, uses left-hand coordinates, which can be described as follows.

Hold out your left hand, and stick your thumb upwards, your first finger straight out from your body, and your second finger pointing to the right. The thumb is y, the first finger is z, and the second finger is x. Got it? Let's get raytracing...

For your first scene, type in the following in a text editor of some sort, and save it as POV1.POV, making sure it is as plain ASCII.


/* Example POV-Ray file - Sphere on plane */

/* The light source - white and at <20, 20, -10> */
light_source{
  <20, 20, -10>
  colour rgb <1.0, 1.0, 1.0>
}

/* The camera, position <0, 5, -16>, looking at <0, 2, 0> */
camera{
  location <0, 5, -16>
  look_at <0, 2, 0>
}

/* The sphere, bright red, and at <0, 4, 0> and a radius of 4 */
sphere {<0, 4, 0>, 4
  pigment {colour rgb <1.0, 0, 0>}
}

/* The floor, bright green, and cutting through the y axis at 0. */
plane{y,0
  pigment {colour rgb <0, 1.0, 0>}
}

The lines which start /* are comments, which are there so you can see what is going on. As you can probably see, each statement, such as sphere, has all of its 'information' between two curly brackets, { and }. This is the case with all statements in POV, and, as in the example of the pigment statements, they can be nested. Be careful about the brackets, as forgetting one can botch it up completely!

After you have typed all this out, make another ASCII file, and call this one POV1.DEF. Type the following into it. These are the 'options' for the trace.


+Ipov1.pov +Opov1_a.tga +W160 +H100 +Q0 +V

Make sure this is in the same folder as your POV-Ray executables! Next, quit the editor, and drag the icon for the POV1.DEF file on to the appropiate .TTP program (mine is POV22_ST.TTP, but if you have a Falcon with an FPU, you can use POV22_TT.TTP, which is apparently a lot faster.) If your desktop doesn't support drag and drop, try installing it as an application, and double-clicking on the DEF file.

After a short while you will have got a file called POV1_A.TGA. This is a Targa image file, which you need to have a suitable program to load or convert. Something like GEM-View or Imagecopy will probably be fine. When you load it, you'll get something like this...

[Test render]

Test render without shadows, shading etc.

Dull, isn't it. Well, that's because it's a test render, to make sure you've got everything right! If yours looks a lot different, or wouldn't render, check it! As all the shapes are in roughly the right places, it's time to render it properly, complete with anti-aliasing (oooh!) and 24 bit colour shading. Time to edit your POV1.DEF file again...


+Ipov1.pov +Opov1_b.tga +W160 +H100 +V +A0.4 +Q9

Try with this one now, you should get a much nicer result, something like the following...

[Final rendering]

Final rendering with shadows, shading and anti-aliasing.

The parameter which turns on anti-aliasing is the +A0.4; this tells POV-Ray to anti-alias to a level of 0.04. The 'vital' commands are as follows...


     +Ixxxxxxxx.POV  Input POV file
     +Oxxxxxxxx.TGA  Output Targa file
     +Wxxxx          Picture width (pixels)
     +Hxxxx          Picture height (pixels)
     +V              Show what it's up to
     +Qx             Picture quality level (0 to 9, 9 is best)

You should be able to edit the POV1.POV file, and put in additional shapes, and light sources if necessary. The most important commands are:-

/* A box with corner at x1, y1, z1, and opposite corner at x2, y2, z2 */
box { <x1, y1, z1>, <x2, y2, z2>
  pigment { colour rgb <r, g, b>
}

/* A cylinder with one end at <x1, y1, z1> other end at <x2, y2, z2>
   radius r */
cylinder { <x1, y1, z1>, <x2, y2, z2>, r
  pigment { colour rgb <r, g, b>
}

/* A plane through axis a, value b
plane {a, b
  pigment { colour rgb <r, g, b>
}

/* A sphere at position <x, y, z>, radius r, colour red r, green g, blue b */
sphere { <x, y, z>, r
  pigment { colour rgb <r, g, b>
}

Probably the most important thing I can tell you is to experiment. There are a lot more commands to be learnt, but the intitial step is probably the hardest. I managed to trace a few simple scenes only after several days of experimentation, as I hadn't any simple documentation, but large quantities of more complex texts, which weren't very helpful. I hope you haven't found this too simple, but raytracing is notoriously difficult to get the hang of.

In the next tutorial, I will explain the more complex functions, such as the Constructive Solid Geometry (CSG), the textures which can be used, and how to use 'include' files. I will leave you with a superb example of what POV can do...

I'm not sure who this is by, but it's one of the POV example files.


Contents
HomePage