VOICE Home Page: http://www.os2voice.org
September 2001

[Newsletter Index]
[Previous Page] [Next Page]
[Feature Index]

editor@os2voice.org


POVRay

By Thorsten Thielen © September 2001, Translation: Christian Hennecke

Computer-generated imaging has experienced heavy development in the last years: few movies get by without using computer-generated effects, few TV-advertisements or TV news programs don't use any computer-generated animations, even whole movies are being produced with computers. The level of realism and natural looks of computer-generated images has become incredible. Often you can't really tell the difference from nature any more. [Editor's note: see the film "Final Fantasy" to experience how far this technology has evolved.]

One method to create such realistic images is the so-called raytracing. From a point of view (camera) simulated light (rays) is cast upon a modelled scene. These rays then hit the objects that have been placed in the scene and the computer calculates the color of the related pixels. Effects like mirroring, transparency, refraction, etc. can be simulated, too, and add a photorealistic look to the images - if you invest enough work that is. :-)


(Click to enlarge)

There are also raytracers for OS/2 available, though the number to choose from has never been really large, and since development of Neon Grafix 3D has ceased, the reviewed POVRay remains the single alternative though a very good alternative that doesn't leave much to be desired, at least for my personal demands.

Features

POVRay offers convenient options for the modelling of objects and the scenery: besides common, relatively simple objects like sphere, quadre, cylinder, cone, and torus it offers quite a number of other kinds of objects:

While one already has a number of outlines to choose from this range of basic objects, the real strengths of POVRay come into play as Constructive Solid Geometry (CSG) enters the arena. Overlaying two or more basic objects makes it very easy to generate any combination of objects. To create a simple drinking-glass, for instance, take a normal cylinder and subtract a slightly smaller cylinder from it to create the inner hollow space. POVRay offers four kinds of overlays:

These features allow one to compose models of nearly any complexity for POVRay.


The next step to a beautiful, realistic picture are textures. After all, things are not defined by their form only, but also by color and surface structure. Stuff of this kind often can add more to a good picture than the modelling itself.

Because of this, POVRay offers an overwhelming number of possibilities. Textures can be roughly differentiated into three areas:

The options POVRay offers especially in the area of textures are much too numerous to be able to describe them in such a review, so I recommend the POVRay manual.

A third area that is important for raytracing is lighting. And, as if it could be different, POVRay offers everything for your heart's content. Besides the usual pointed light-sources, spotlights and cylindric light-sources (whose light rays move in a cylindric form and which are very suitable for the display of e.g. "laser beams") are available. So-called "area lights" allow for more realistic and smoother casting of object shadows (while requiring more computing power). Light-sources can be assigned any color and brightness. You can even adapt the decrease in light intensity by greater distance to your liking.


(Click to enlarge)

Another important setting that influences the look of the generated images is the camera. Different kinds of projection generate different effects (fish-eye, parallel projection, etc.) and the camera identifier feature enables you to define different cameras for a scene and exchange them quickly so you can view a scene from different perspectives, for instance.


POVRay has many further features in store, e.g. atmospheric effects like fog, rainbows and of course sky spheres for creation of realistic sky views. The "media" concept provides rendering of e.g. smoke or fire - though I haven't got that far in this area and thus can only say that this area is quite complex and needs some experience, but is able to create extraordinary results.

So far we have only looked at static images, but POVRay is also capable of generating animations of course. (OK, of single frames precisely that form an animation if truth be told. A program that puts them together to an AVI or MPEG file is still required.) Movement of objects, changing of textures, lighting, etc. are available. Here we arrive at a point that casts some shade on POVRay. At least for some, while it's more of an advantage for others (e.g. for me :-)):

Scene creation

In POVRay creation and direction of scenes is entirely done via text files that include all definitions for objects, look, lighting, etc. With the help of POVRay's scene description language all objects are created, described and placed. This may sound pretty complicated and unhandy at first, but it is quite simple and - most importantly - flexible. A small example:



include "colors.inc" background { color Cyan } camera { location <0, 2, -3> look_at <0, 1, 2> } sphere { <0, 1, 2>, 2 texture { pigment { color Yellow } } } light_source { <2, 4, -3> color White}
The first statement loads some useful color definitions, so that you can easily address a number of them by name. This is already used in the second row where the background color for the whole scene is set to cyan. Next is the definition of the camera's point of view: It is two units above and three units behind the origin of our world. From there it focuses a point that is one unit above the origin and two units into the picture plane. Now on to our object: a sphere that is located at this very point with a radius of two units. The surface texture is kept very simple, only colored in yellow, without any further modification of normals or other effects (finish). Finally a light source is placed at the top-right of and behind the origin, which evenly illuminates our scene in pure white. These directions are saved to a file, e.g. "demo.pov". Now we can generate the image by issueing the command:
povray +Idemo.pov +Odemo.tga

Even though this method of programming/scene definition may seem quite inconvenient to some and admittedly requires a certain imagination, it offers several advantages; the positioning of objects, for instance, can be controlled much better than by placing them with e.g. a mouse. Applying modifications to a scene, e.g. to hide certain objects for a short time to decrease rendering time for a preview, is easily achievable by just commenting out a line. Moreover, this format provides the useful capability of generating scenes or objects using macros, which makes creation of e.g. trees, grass, etc. very flexible and easy. The sky-scrapers in the first screenshot were done using a macro.

Add-ons

Moray, a graphic modeller for POVRay is available. However, it is shareware and there are only versions for MS-DOS and Win32. The MS-DOS version runs under OS/2, but it is neither up to date nor will it be updated any more. I had a short look at Moray and it seems to be a powerful program, but I found parts of the interface to be overly complicated. There is also a native, free modeller called ForeSpace (available on Hobbes) for OS/2 PM that seems to be quite OK (I had a very short look), but seems to still contain some bugs.

Conclusion

Besides the port to OS/2 by Stefan Schwarzer, there is another version by Alexander Mai. His package also includes a realtime viewer for XFree86/OS2. A comment from Stefan:

Both ports (Alexander's and mine) are based on the same version of POVRay and have their pros and cons. As Alexander's port is compiled for XFree86/OS2, he could offer the realtime preview very easily. My port includes the POVRay help as INF file and a few REXX scripts to create some desktop objects for drag and drop rendering. I guess the best is to use my port with Alexander's binary ;-).

To draw the conclusion: POVRay is a powerful tool for creation of computer-generated images whose usage might not suit everybody, but which honours the work invested with remarkable results.

References:
POVRay
Developer: Stefan Schwarzer - s.schwarzer@ndh.net (OS/2 port), Alexander Mai - st002279@hrzpub.tu-darmstadt.de (XFree86/OS2 port)
Price: Freeware

POVRay homepage - http://www.povray.org
POVRay for OS/2 - http://hobbes.nmsu.edu/pub/os2/apps/graphics/ray/pov/
POVRay for XFree86/OS2 - http://homepages.tu-darmstadt.de/~st002279/os2/html/povray.html


[Feature Index]
editor@os2voice.org
[Previous Page] [Newsletter Index] [Next Page]
VOICE Home Page: http://www.os2voice.org