Home Index Search Links About Us
[LinuxFocus Image]
[Navegation Bar]
  News   Archives   Companies   Tips  

Beginning with Povray

by Antonio Castro


Introduction

Some features of Povray

Getting Povray

Installing

Set up

POV

This article begins a series about the Povray raytracer. The purpose of the current article is to help novice Linux users to get started with POV-Ray.

Persistence of Vision Ray-Tracer (POV-Ray) Copyright 1996 POV-Team.


Introduction.

Povray (Persistence of Vision Raytracer) is basically a ray tracer. It is hard to explain what this term means without getting into a number of details so let us leave a detailed explanation of what a ray tracer is for future articles. For the moment it suffices to sketch the concept of raytracing: It is a technique to render imaginary scences defined in the computer through the use of models, which declare the existence of objects and their shapes, as well as points, light sources and a camera. The computer tries to render an image as reallisticaly as possible while mantaining a minimum processing time.

When possible POV-Ray tries to imitate nature. Sometimes POV-Ray has to settle for just imitating or simulating a natural effect. Without such shortcuts it would be impossible to render an image in a reasonable amount of time. Raytracing algorithms work by computing a large amount of rays (like light beams), however these rays do not behave like real optical rays. In nature, rays originate in light sources, move in space and whenever they encounter a physical obstacle (i.e a surface) they scatter, generating a new ray that goes from the point on impact to the retina's viewer or the camera's film. On the other hand, in a raytracer rays move backwards, from the viewer or film to the objects and then back to the light sources. We will leave a detailed explanation as to why and how of this algorithm for the next article.

The quality of Povray is excellent and is comparable to most commercial raytracers. Commercial design products based on raytracing do have integrated tools for designing confortably all sort of objects.

In the case of Povray, it is possible to use modellers from different independent companies or format filters, and in general the user has a great variety of tools available. This does not mean that it is impossible to achieve a beautiful or even fantastic design using exclusively Povray. Imagination is all that is required.

Another important point is that the source code is public, allowing us to examine the various techniques used. Povray's copyright is described in Appendix A of the manual, as Linux it is a freeware licence. Check out the details in the original licence.

There is a Povray manual available in a text version (easy for fast browsing), in HTML and postscript formats. If you think to print out the postscript file, you should prepare about 600 sheets; huge because of the great possibilities of Povray, but do not feel intimidated. In the present article you will be able to try out Povray and in next articles we will learn basic concepts.

Povray lets us enter the world of infography through the front door, all thanks to its wonderful technical capabilities. My concept of infography is based on the notion that although pure technique can help us to obtain images with high realism, nevertheless artistic value does not equal realism nor technique itself. Technology is a valuable assistance, but everything that has real artistic value has to be conceived in our minds first. The idea is the main goal.

Many times I like to play with the concepts of realism and fantasy. Infography allows us to play this game of one and a thousand shapes creating an interesting conflict in the viewer.
I keep a small image gallery created using Povray at:

http://slug.ctv.es/~acastro/infograf/catalog.htm

Here is an example, a hybrid design: an airplane, a sailing ship and a seagull.

Seagull 1 

Seagull 1

In this first image we can see more likely a seagull.

 

Seagull 2 

Seagull 2

However, from a second perspective you can say that it resembles more an airplane while it is still the same object.

The object has the silhoulette of a seagull. In the upper part, it has a transparent cockpit and two pilots are easily visible. The pigmentation is strange but with the raytracing these pictures can achieve a degree of astonishing realism.

If you show these pictures to a 5-year old child, and ask him what he sees, he will likely answer that it is a photo, not a drawing. Showing the same pictures to an adult, he would have some difficulties to classify it. He will say that it is clearly neither a drawing nor a photo. Maybe he will know that was produced by a computer, but how can a machine can create this strange and beautiful scene?

This kind of effect is the one I seek in my designs. Conflicting images where synthetic and artificial are put together in harmony with several realistic features. For it you need without a doubt imagination and a good knowledge of the technique. On the other hand, to get very realistic images, you should have a complete control over the technique, but maybe this can not be necessarely called art.

I have truly spent many very good times with Povray and I'm sure that anyone that gets to know it will enjoy it the same.  

Some of the most important features of Povray

  • Partial rendering of an image. It is possible to continue processing a previously interrupted redering.
  • Options for rendering with different resolutions and perfection scales in order to decrease processing time.
  • Capable of displaying an image while creating it. (In SVGA and XWindows).
  • Quick mosaic style preview.
  • Complete logging of operations with profiling information that let us examine what steps consume the most CPU time.
  • Preliminary syntactic parsing with a good error detection.
  • Large number of libraries of textures, with enormous possibilities for the creation of any kind of texture.
  • Surface effects: roughness, bright, reflections, transparency, etc,
  • Simple geometrical primitives (spheres, cones, planes, cubes, prisms, etc.).
  • Geometrical objects based on complex mathematical equations.
  • Shapes formed with meshes of triangles.
  • Smoothening of edges, e.g. on surfaces defined by a mesh of triangles.
  • Complex objects made by aggregation of simpler ones.
  • Delimitation of complex objects by means of simple shapes to optimise the efficiency of the tracer.
  • Shape pigmentation from a plain image.
  • Shapes generated from a flat colored image by raising the pixels proportionaly to its color (Very useful for generating terrains).
  • Objects generated by revolution.
  • 3-D texts from TIFF sources.
  • Atmospheric effects, e.g. mists.
  • Lighting effects with several kinds of light sources, spot lights, etc.
  • Different options of antialiasing. Antialiasing enhances our line appearence by removing the well-known stair effect that often happens at low resolution. Povray offers several methods for antialiasing.
  • A complete language for scene description.
  • Generation of animations through several methods:
    1. External loop (option Clock=n.n).
    2. Internal loop (using internal parameters within the source itself).
    3. It allows to define constants defining them in a include file, so it's possible to produce external animations by utilities or scripts that update these includes every animation step.

How to obtain Povray

Povray can be obtained by ftp.
The official site where you can get it, is the following:

http://www.povray.org  
ftp://ftp.povray.org  
 

There is also an electronic magazine about povray, however, it looks abandoned, it keeps some good issues that first appeared when the Povray 3.0 was released.

http://www.povray.org/pub/povray/ezine  
 

There are lots of MIRRORS but none of them are official.
 
 
FTP 
sunsite.wits.ac.za:/pub/mirrors/ftp.povray.org 
gd.tuwien.ac.at:/graphics/raytracing/povray 
ftp.cdrom.com:/pub/povray 
wuarchive.wustl.edu:/graphics/graphics/mirrors/ftp.povray.org 
ftp.shu.ac.uk:/pub/computing/packages/raytrace/ftp.povray.org 
sunsite.doc.ic.ac.uk:/Mirrors/ftp.povray.org 
www.hensa.ac.uk:/ftp/mirrors/povray 
ftp.etsimo.uniovi.es:/pub/raytrace 
ftp.fh-rosenheim.de:/pub/mirror/ftp.povray.org 
ftp.tu-clausthal.de:/pub/mirror/povray 
kermit.stud.fh-heilbronn.de:/mirrors/povray 
ftp.uni-erlangen.de:/pub/other/povray 
stef.u-picardie.fr:/pub2/ftp.povray.org 
ftp.ncu.edu.tw:/Packages/ray-tracing 
ftp.vu.union.edu:/pub/povray 
sunsite.icm.edu.pl:/pub/povray/ 
uiarchive.cso.uiuc.edu:/pub/graphics/povray/ 
ftp.flashnet.it:/pub/ftp.povray.org/ 
ftp.univ-lille1.fr:/pub/povray 
ring.asahi-net.or.jp/pub/misc/povray/ 

HTTP 
www.etsimo.uniovi.es/ftp/pub/raytrace 
stef.u-picardie.fr/ftp/pub2/ftp.povray.org 
www.vu.union.edu/~ftp/pub/povray 
sunsite.icm.edu.pl/pub/povray 
ftp.ncu.edu.tw/Packages/ray-tracing/ 
serviceftp.flashnet.it/mirrors.htm 
kermit.stud.fh-heilbronn.de/povray 
ftp.uni-erlangen.de/pub/other/povray/ 
http://gd.tuwien.ac.at/graphics/raytracing/povray/ 
ftp.tu-clausthal.de/pub/mirror/povray

 

Index: (15-Enero-1998) ftp.povray.org

Here, we enclose a short listing of the contents of the official site.
 
 
 
 
 pub
   lrwxr-xr-x  1 povray  vuser   15 Aug 24 11:12 HEADER -> povray/.message
   drwxr-xr-x  5 povray  vuser  512 Aug 24 13:13 povray
 pub/povray
   -rw-r--r--   1 povray  vuser   305 Jan  9 01:30 .message
   lrwxr-xr-x   1 povray  vuser     8 Aug 24 13:13 HEADER -> .message
   dr-xr-xr-x   2 povray  vuser  1536 Aug 24 13:13 Hall-Of-Fame
   -r--r--r--   1 povray  vuser  3262 Aug 24 10:52 MIRRORS
   dr-xr-xr-x  10 povray  vuser   512 Aug 24 11:14 Official-3.0
   -r--r--r--   1 povray  vuser  3262 Aug 24 10:52 README.MIRRORS
   -r--r--r--   1 povray  vuser  3731 Aug 24 10:52 README.MIRRORS.HTML
   dr-xr-xr-x   2 povray  vuser  1024 Aug 24 13:13 Ray-Tracing-News
 pub/povray/Hall-Of-Fame
   -r--r--r--  1 1017  1017  235235 May 14  1996 6x86.jpg
   -r--r--r--  1 1017  1017  393630 Sep 30  1994 6z4.jpg
   -r--r--r--  1 1017  1017     308 Sep 30  1994 6z4jpg.txt
   -r--r--r--  1 1017  1017  154256 Oct 13  1995 astplant.jpg
   -r--r--r--  1 1017  1017    2991 Oct 13  1995 astplant.txt
   -r--r--r--  1 1017  1017  110322 Sep 30  1994 ballz5.gif
   -r--r--r--  1 1017  1017  287164 Dec  8  1994 bell_jar.jpg
   -r--r--r--  1 1017  1017   57111 Oct 13  1995 bkntools.jpg
   -r--r--r--  1 1017  1017     610 Oct 13  1995 bkntools.txt
   -r--r--r--  1 1017  1017  331058 Sep 30  1994 brass.jpg
   -r--r--r--  1 1017  1017     254 Sep 30  1994 brass.txt
   -r--r--r--  1 1017  1017  284250 Sep 30  1994 bug1.gif
   -r--r--r--  1 1017  1017  279273 Sep 30  1994 camera.jpg
   -r--r--r--  1 1017  1017  367490 Oct 13  1995 crane.jpg
   -r--r--r--  1 1017  1017    2650 Oct 13  1995 crane.txt
   -r--r--r--  1 1017  1017  101473 Sep 30  1994 dragons.jpg
   -r--r--r--  1 1017  1017  295129 Sep 30  1994 frosty.gif
   -r--r--r--  1 1017  1017  777531 Sep 30  1994 frosty.tga.zip
   -r--r--r--  1 1017  1017   88350 Sep 30  1994 geodome.jpg
   -r--r--r--  1 1017  1017    2252 Sep 30  1994 geodome.txt
   -r--r--r--  1 1017  1017   11801 Sep 30  1994 geosmall.gif
   -r--r--r--  1 1017  1017  356889 Oct 13  1995 gofood1.jpg
   -r--r--r--  1 1017  1017     483 Oct 13  1995 gofood1.txt
   -r--r--r--  1 1017  1017  375781 Oct 13  1995 gogadget.jpg
   -r--r--r--  1 1017  1017     825 Oct 13  1995 gogadget.txt
   -r--r--r--  1 1017  1017   72337 Oct 13  1995 info_hwy.jpg
   -r--r--r--  1 1017  1017    1796 Oct 13  1995 info_hwy.txt
   -r--r--r--  1 1017  1017  109462 Oct 13  1995 jmwarmup.jpg
   -r--r--r--  1 1017  1017    3346 Oct 13  1995 jmwarmup.txt
   -r--r--r--  1 1017  1017     628 Sep 30  1994 julia.txt
   -r--r--r--  1 1017  1017   50762 Sep 30  1994 kettle.jpg
   -r--r--r--  1 1017  1017  295555 Sep 30  1994 kkteaset.jpg
   -r--r--r--  1 1017  1017      96 Sep 30  1994 kkteaset.txt
   -r--r--r--  1 1017  1017  151503 Sep 30  1994 lionfish.gif
   -r--r--r--  1 1017  1017     112 Sep 30  1994 mindmaz1.txt
   -r--r--r--  1 1017  1017  341101 Sep 30  1994 museum.jpg
   -r--r--r--  1 1017  1017     564 Sep 30  1994 museum.txt
   -r--r--r--  1 1017  1017  364856 Aug 19  1995 pcktwtch.gif
   -r--r--r--  1 1017  1017     580 Aug 19  1995 pcktwtch.txt
   -r--r--r--  1 1017  1017  590679 Jan 29  1996 pcktwtch.zip
   -r--r--r--  1 1017  1017     417 Sep 30  1994 pclock.txt
   -r--r--r--  1 1017  1017  213426 Sep 30  1994 plntscap.gif
   -r--r--r--  1 1017  1017    2558 Sep 30  1994 plntscap.txt
   -r--r--r--  1 1017  1017  125648 Oct 13  1995 springeq.jpg
   -r--r--r--  1 1017  1017    1129 Oct 13  1995 springeq.txt
   -r--r--r--  1 1017  1017  239594 Sep 30  1994 studying.jpg
   -r--r--r--  1 1017  1017  244179 Oct 13  1995 subrace.jpg
   -r--r--r--  1 1017  1017    2681 Oct 13  1995 subrace.txt
   -r--r--r--  1 1017  1017  191332 Sep 30  1994 sundae.gif
   -r--r--r--  1 1017  1017  162140 Sep 30  1994 woild2.gif
 pub/povray/Official-3.0
   -r--r--r--  1 povray  vuser     80 Jul 20 01:47 .message
   drwxr-xr-x  2 povray  vuser    512 Dec 16 03:53 Amiga
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:31 Docs
   lr-xr-xr-x  1 povray  vuser     11 Aug 24 11:14 HEADER -> ../.message
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:31 Linux
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:31 MS-Dos
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:36 Macintosh
   -r--r--r--  1 povray  vuser     83 Jul 20 01:48 README
   -r--r--r--  1 povray  vuser    222 Feb  6  1997 README.HTML-DOCS
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:31 SunOS
   dr-xr-xr-x  2 povray  vuser    512 Aug 24 10:32 Unix
   dr-xr-xr-x  3 povray  vuser    512 Aug 24 10:32 Windows
   -r--r--r--  1 povray  vuser  15055 Jul 19  1996 gamma.gif
   -r--r--r--  1 povray  vuser   1776 Jul 19  1996 gamma.gif.txt
   -r--r--r--  1 povray  vuser   3735 Feb  6  1997 news.3.01.txt
   -r--r--r--  1 povray  vuser  18452 Feb  5  1997 povlegal.doc
   -r--r--r--  1 povray  vuser  24060 Feb  1  1997 povwhere.get
   -r--r--r--  1 povray  vuser    110 Aug 24 11:01 www.html
 pub/povray/Official-3.0/Docs
   -r--r--r--  1 1017  1017      413 Feb  7  1997 README
   -r--r--r--  1 1017  1017   286517 Feb  7  1997 povdoc.zip
   -r--r--r--  1 1017  1017   764628 Feb  7  1997 povdocps.zip
   -r--r--r--  1 1017  1017  1601733 Feb  7  1997 povhtml.zip
   -r--r--r--  1 1017  1017    18452 Feb  7  1997 povlegal.doc
   -r--r--r--  1 1017  1017    24060 Feb  2  1997 povwhere.get
 pub/povray/Official-3.0/Linux * * * * *
   -r--r--r--  1 povray  vuser      786 Jul 20 01:41 00_index.txt
   -r--r--r--  1 povray  vuser      442 Jul 20 01:42 README
   -r--r--r--  1 povray  vuser  1506794 Feb  2  1997 povdoc.html.tgz
   -r--r--r--  1 povray  vuser   908752 Aug  1  1996 povdoc.ps.gz
   -r--r--r--  1 povray  vuser  1678592 Jul 18 13:02 povlinux.tgz

Linux users will be specially interested in two directories: 'pub/povray/Official-3.0/Linux' and 'pub/povray/Hall-Of-Fame'  In latter we will find what we can not find in the great Povray handbook: Examples.

The Povray handbook is really good but an image is better than thousand words. First the handbook is not illustrated in the proper way. And second in the other directory we can find several images that are an ideal complement for the handbook. I'm not saying that the handbook hasn't got enough examples, on the contrary it shows many. Every example explains a concept, and it is all right to acquire technical knowledge. Some handbook's examples are very beautiful, but 'Hall-Of-Fame' contains a selection of the best images ever created: a real infografic gallery. Every picture has attached a text explaining the tools and techniques used to obtain the incredible result.

We have to be aware that many of the tools mentioned (in the handbook) as modellers, filters, etc. as a general rule are not available for Linux yet.

We advise to download  ftp.povray.org/pub/povray/Official-3.0/Linux and also ftp.povray.org/pub/povray/Hall-Of-Fame  not only to enjoy the pictures, but as an important starting point for designing.

We will describe how to execute a typical installation (it should work in every Linux version, but it has been only completely tested with Debian).
  

Installing

As it is usual in installations, we have to log in as super user (root).
Let us assume that we have the distribution in the directory: "/incoming/pub/povray/Official-3.0/Linux"  
Then type in the following commands  
 
 
        # mkdir /usr/local/sbin 
        # mkdir /usr/local/apli 
        # mkdir /usr/local/apli/povray 
        # cp "/incoming/pub/povray/Official-3.0/Linux" /usr/local/povray 
        # cd /usr/local/povray 
        # tar -xzf povlinux.tgz 
        # tar -xzf povdoc.html.tgz 
        # cd /usr/local/sbin 
        # ln -s /usr/local/apli/povray/povray3/x-povray x-povray 
        # ln -s /usr/local/apli/povray/povray3/s-povray s-povray 
 
The last sequence of commands installed everything: there is nothing to be compiled.
You only have to check if the execution permissions are set for everybody in every directory in /usr/local/apli/povray/povray3 and for the x-povray and s-povray executables. 
In our case, we needed to change these permissions with 'chmod 755 (directory or file)'.   

Setup

Povray setup process is useful to make accessible the "include" files library, to configure the graphics card, to define input and output file formats and many other features.

Instead of explaining questions that are very well detailed in the handbook (Quick start), we will consider a generic configuration that will allow Linux users to use Povray in an easy, comfortable and immediate way.

Povray can display in SVGA mode but this is a card-dependent issue. We will consider that you have an installation with Xwindows and using as image displayer 'xv'. 

The Linux configuration in the newer versions of povray can be simplified. It is possible to use environment variables, but it is more practical to create a config file *.ini with all you need.

There are several *.ini sample files for general purposes. This provides several possibilities to set up the configuration. It is possible to refer our default configuration file in a environment file, or to use variables to locate the default include library, etc.. It also could be a good idea to pass as arguments a number of options, but we pass almost everything in a configuration file (*.ini) that at the same time we will specify as an argument of the command line. If you do not like this method, check out the handbook and you will see that there are several options to obtain the same result, however it is not a question for an introductory article to detail each option, but only the most useful.

There is also a shell script for generating the images corresponding to all the examples 'allscene.sh'. 

Maybe instead of generating all the scenes with a low resolution, you would like to choose one and render it with the highest resolution.

In this case, go to the example directory and execute povray using the following 'ini' file: 

-------------------------8<------------(ini.ini)----------------
Width=640
Height=480
Quality=8
Library_Path=/usr/local/apli/povray/povray3/include
Output_to_File=on
Output_File_Type=t
Output_File_Name=out.tga
verbose=on
-------------------------8<--------------------------------------
The first two lines will determine the resolution of the final image.
The command to obtain the image is:

$ s-povray ini.ini +i source.pov 

The file 'source.pov' is the name of the file that we would like to process, obtaining an image 'out.tga' that we can display with, for example, 'xv out.tga'.  

POV: a utility to work with Povray

'pov' is a shell-script for using POV-ray easily. First we will show its listing:
------------------------8<-----------------------------------
#!/bin/bash
#####################################################################
#  Autor: Antonio Castro Snurmacher  (1.998)
#
#       pov (ver 1.0)
#
#       Esta versión esta dedicada a su inclusión en la
#       revista LinuxFocus   (freeware)
# 
#  Este programa puede ser utilizado, distribuido, y modificado
#  libremente pero siempre se deberá respetar la propiedad
#  intelectual de su autor. Esta cabecera debe ser conservada 
#  tal cual en todas las modificaciones. 
#
#  En caso de traducción deberá conservarse el texto original de
#  esta cabecera y añadirse la traducción a continuación de ella.
#
#  El autor renuncia a todo tipo de beneficio económico y no se hace 
#  responsable de los posibles perjuicios derivados del uso del mismo. 
# 
#  E-mail (acastro@ctv.es)
# 
#####################################################################
#  Author: Antonio Castro Snurmacher  (1.998)
#
#       pov (ver 1.0)
#
#       This version has been written to be included in
#       the LinuxFocus magazine   (freeware)
# 
#  This program can be used, distributed, and modified
#  freely but always has to respect the intellectual
#  property of the author. This header should be kept
#  untouched in every modification.
#
#  In case of translation the text of this header should be kept
#  and the translation will be added after it.
#
#  The author renounces to any kind of economic benefit
#  and he is not responsible for any damage derived from
#  the use of this script.
# 
#  E-mail (acastro@ctv.es)
# 
#####################################################################
usage(){
   echo "Usage: pov (project) (size=0..6) (quality=1..11)"
   echo
   echo "0) 40x30     (STD/20) No backup"
   echo "1) 80x60     (STD/10) No backup"
   echo "2) 100x75    (STD/8)  No backup"
   echo "3) 200x150   (STD/4)"
   echo "4) 266x200   (STD/3)"
   echo "5) 320x200 *"
   echo "6) 400x300   (STD/2)"
   echo "7) 640x480 *"
   echo "8) 800x600 *   (STD)"
   echo "9) 1024x768 *"
   echo
   echo "The projects should be located in the directory pointed by"
   echo "${HOMEPOV} and will use the same name for it and for"
   echo "the main source file *.pov"
   echo "(STD) is the standard resolution chosen."
   echo
   exit 1
}

newversion(){
mv ${PREFIX}.pov.8.gz ${PREFIX}.pov.9.gz 2> /dev/null
mv ${PREFIX}.pov.7.gz ${PREFIX}.pov.8.gz 2> /dev/null
mv ${PREFIX}.pov.6.gz ${PREFIX}.pov.7.gz 2> /dev/null
mv ${PREFIX}.pov.5.gz ${PREFIX}.pov.6.gz 2> /dev/null
mv ${PREFIX}.pov.4.gz ${PREFIX}.pov.5.gz 2> /dev/null
mv ${PREFIX}.pov.3 ${PREFIX}.pov.4 2> /dev/null
mv ${PREFIX}.pov.2 ${PREFIX}.pov.3 2> /dev/null
mv ${PREFIX}.pov.1 ${PREFIX}.pov.2 2> /dev/null
cp ${PREFIX}.pov   ${PREFIX}.pov.1 
gzip ${PREFIX}.pov.4 2> /dev/null
}

#################################################
size(){
   export SAVE="yes"
   case  $1 in
      0) Width=40 ; Height=30; SAVE="no" ;;
      1) Width=80 ; Height=60  SAVE="no" ;;
      2) Width=100; Height=75  SAVE="no" ;;
      3) Width=200; Height=150;;
      4) Width=266; Height=200;;
      5) Width=320; Height=200;;
      6) Width=400 ;Height=300;;
      7) Width=640 ;Height=480;;
      8) Width=800 ;Height=600;;
      9) Width=1024;Height=768;;
      *) usage
   esac
}

quality(){
   case $1 in
        1) ;;
        2) ;;
        3) ;;
        4) ;;
        5) ;;
        6) ;;
        7) ;;
        8) ;;
        9) ;;
        10) ;;
        11) ;;
       *) usage
   esac
   export Quality=$1
}

####################### main ##############################
export HOMEPOV=${HOME}/dat/pov
export PROYECT=$1
export PREFIX=${HOMEPOV}/${PROYECT}/${PROYECT}
if [ $# != 3 ]
   then usage
fi
export POVRAY=/usr/local/apli/povray/povray3
size $2
quality $3
if [ $SAVE == "yes" ]
   then newversion
fi
cat <<-FIN > ${PREFIX}.ini
   Width=$Width
   Height=$Height
   Quality=$Quality
   Library_Path=${POVRAY}/include
   Input_File_Name=${PREFIX}.pov
   Output_to_File=on
   Output_File_Type=t
   Output_File_Name=${PREFIX}.tga
   verbose=on
   Post_Scene_Command=xv ${PREFIX}.tga
FIN
#   Output_File_Type=t
## Others hight performace options ##
#   Antialias_Depth=3
#   Antialias=On
#   Antialias_Threshold=0.1
#   Jitter_Amount=0.5
#   Jitter=On

# Low priority, maybe I want to do other things.
nice -20 x-povray ${PREFIX}.ini 

if [ $SAVE != "yes" ]
    then echo "Warning !! There is no backup of this version."

fi

------------------------8<-----------------------------------
When we are designing, we often have to test ideas many times, and we get closer to our ideal step by step.

To simplify the execution we are going to implement a shell-script that generates a *.ini file, executes Povray tracer and after that displays the result. We assume that we are working in the directory $HOME/dat/pov/(project name) and that the name of the main file is (project name.pov)

This script generate files *.ini that usually are enough for most situations. It is oriented to a specific way of working, but if you prefer another, it is easy to change.

This utility backups the last changes on the source files because very often we would like to revert to a previous version; after making many changes looking for different results, often we decide to go back to a previous design path. As we mentioned above, the creative process looks like brush painting, we decide step by step how to continue.

If we execute the script with the lowest resolutions, it generates no backup copy nor new version number: low resolution is an uniteresting test. With this kind of tests, you can just get an idea on the relative positions of the objects. This is a personal way of working, very easy. If your are not familiar with Povray it will be a good starting methodology. Maybe later you would like to adapt this tool to your particular necessities.

Some of the available resolutions are the same as the standards modes of some video resolutions. Others are fractions of the 800x600 resolution. Type in 'pov' without arguments to ge a short help menu.

Create an appropriate directory structure to work with it within your $HOME directory and you will see how easy is to work from the first day. We will base our exercises in the use of this tool. However it is not necessary to use it, it will more comfortable for you.

We will begin with a simple example to check that everything works:

------------------------8<-----------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"

// Author: Antonio Castro

// The camera will look towards the contact point
// of both spheres

camera {
  location <0, 15, 35>
  look_at <0, 10, 0>
}

// Source of white light
object {
  light_source {
  <20, 100, 50>
  color White
  }
}

// Sky with white clouds
object {
 sphere { <0, 0, 0> 200000}  // Great vault of heaven
 texture {Blue_Sky scale <50000, 6000, 50000>} // We strecht the clouds
}

// Golden ball
sphere { <-10, 10, 0> 10   
    texture { Gold_Metal }
}

// Mirror ball
sphere { <10, 10, 0> 10  
    texture { Mirror }
}

// Glass ball
sphere { <0, 5, 10> 5   
    texture { T_Glass1 }
}

// Floor 
// It is made with a great sphere that touches the center <0,0,0>
// but it could be implemented with a plane.
sphere {<0, -1000000, 0> 1000000
 pigment {checker color Red color Yellow scale 2 } // Checker texture
}
------------------------8<-----------------------------------
Copy it in $HOME/dat/pov/sample1/sample1.pov 
If it is necessary create first the correct directory structure. Then use the 'pov' utility provided in this article, executing it from a XWindows xterminal session with your user as login.

$ pov sample1 4 9 

You should launch 'xv' to display it. When you plan to implement your own scenes, we recommend to open another 'xterm' window with the text verion of the handbook in the 'vi' for example, in read only mode to search in a fast way the keywords of the language, consulting its syntax, and some example of its use.

sample1 

../../common/March1998/sample1.gif 
 
 

Translated by David Escorial

 

© 1998 Antonio Castro
This website is mantained by Miguel A Sepulveda.

mirror server hosted at Truenetwork, Russian Federation.