Computer Graphics Hardware and Algorithms 215 (623.215)

POV-Ray Tutorial

This tutorial is designed to give you an introduction to the Persistance of Vision Ray-Tracer. It's designed to work closely with the HTML User Documentation.

Setting up POV-Ray

Add the following lines to your ~/.cshrc or ~/.irix/cshrc file:
   # add the computer graphics directory to your path
        set path = ($path /usr/local/units/cgha215/labs/bin/)
        setenv POVINI /usr/local/units/cgha215/labs/povray/povray.ini
You'll then have to type source ~/.cshrc to make those changes effective in the current shell.

Questions and Tasks

  1. What does POV-Ray do which is different from OpenGL?
    Unlike OpenGL POV-Ray implements the physical modelling of light rays
    interacting with objects in the scene. This means you can do proper
    shadows, reflectivity and translucency, which you can't do with OpenGL.
    POV-Ray also allow you to add texture mapping, halos, surface finishes
    and bumps, complex objects generated from splines, and to use a whole 
    heap of other rendering techniques.
    

  2. How do I run it? How do I look at the image it produced? What do all of the (see command line switches) do? What is a .ini file?
    You can run it using povray or x-povray. The difference is that x-povray
    can be made to generate an image in a window as it renders the scene. It
    will take a .pov scene file, render it and produce a .tga file.
    
    Some of the important flags are:
      +I            The .pov input filename (.pov is optional)
      +D0 +D1       Draw the image as the scene is being rendered
      +w640 +h480   Create an image which is 640x480
      +p            Pause after rendering and wait for user input.
    
    The .ini file is a configuration file which can be used set
    the command line options so we don't have to type them in 
    each time. Currently POV-Ray is set to use the 
    ~cgha215/labs/povray/povray.ini file. You can however use your own.
    If you do you'll have to remember to copy the Library_Path=
    lines from the povray.ini file to your own.
    
    An example invocation would be:
      x-povray +Ishapes +d1 
    This would render shapes.pov with povray.ini and create the file
    shapes.tga. It would also draw the image to the screen as it is
    rendered.
    
    If you wanted to use your own .ini file instead of povray.ini you would
    use:
      x-povray my_own.ini +Ishapes +d1
    
  3. POV-Ray uses a left handed co-ordinate system. How is this different from OpenGL? How does it affect our rotations?
    In a left handed co-ordinate system the positive x and y directions
    are right and up respectively. The positive z direction is away from the
    viewer. OpenGL uses a right handed co-ordinate system. In OpenGL the
    positive direction is towards the viewer. 
    
    With a left handed co-ordinate system a positive rotation would be
    clockwise around the axis. This is the opposite of OpenGL.
    

  4. Set up the camera and sphere by following the instructions in the html documentation about cameras and objects.

  5. Add another shape such as a cone or cylinder (Simple Shapes) to your scene.

  6. Change the surface finish of your sphere using the Surface Finishes documentation.

  7. Finally, complete the light source section of the tutorial.

The rest of the documentation examples can be done at your leisure. They include more advanced objects, atmospheric effects, more textures, simple animation and other advanced rendering techniques.

There are also more example scenes in the povray directory (/usr/local/units/cgha215/labs/povray).

If there are any problems please email Philip Dunstan.