Tutorial Section 1Documentation
This document is protected, so submissions, corrections and discussions should be held on this documents talk page.
This document provides a tutorial for the Persistence of Vision Ray-Tracer™ (POV-Ray). The documentation applies to all platforms to which this version of POV-Ray is ported. The platform-specific documentation is available for each platform separately.
The tutorial is divided into five main parts:
- This introduction which explains what POV-Ray is and what ray-tracing is. It gives a brief overview of how to create ray-traced images.
- A Beginning Tutorial which explains step by step how to use the different features of POV-Ray.
- An Advanced Tutorial which contains more advanced tutorial topics.
- POV-Ray questions and tips gives answers to many frequently-asked questions about POV-Ray.
- In the Appendices you will find some tips and hints, where to get the latest version and versions for other platforms, the POV-Ray licence, information on compiling custom versions of POV-Ray, suggested reading, contact addresses and legal information.
The current release of POV-Ray runs on 32 and 64-bit versions of Microsoft Windows from XP through Windows 8, Mac OS X, Linux/UNIX, and numerous other platforms (when compiled from source).
If you do not yet have POV-Ray installed or are not sure you have the official version or the latest version, see appendix What to do if you don't have POV-Ray.
This book covers only the generic parts of the program which are common to each version.
Note: Each version has platform-specific documentation not included in this section.
We recommend you finish reading this introductory section then read the platform-specific information before reading the rest of the tutorial. The platform-specific docs will show you how to render a sample scene and will give you detailed descriptions of the platform-specific features.
The Windows version documentation is available on the POV-Ray program's Help menu or by pressing the F1 key while in the program.
The Unix / Linux version documentation can be found at the same place as
the platform independent part. Usually that is
The Persistence of Vision Ray-Tracer creates three-dimensional, photo-realistic images using a rendering technique called ray-tracing. It reads in a text file containing information describing the objects and lighting in a scene and generates an image of that scene from the view point of a camera also described in the text file. Ray-tracing is not a fast process by any means, but it produces very high quality images with realistic reflections, shading, perspective and other effects.
What is Ray-Tracing?
Ray-tracing is a rendering technique that calculates an image of a scene by simulating the way rays of light travel in the real world. However it does this simulation backwards; in the real world, rays of light are emitted from a light source and then strike objects. Some of the light rays then bounce off the objects and enter our eyes (or perhaps a camera). However, most of the rays never reach anything that 'observes' them; they either leave the area of interest or are absorbed by objects within it.
Because the vast majority of rays never reach an observer, it would take a very long time for software to trace even a simple image if the rays were cast as they were in the real world (because almost all of the calculations would end up going to waste). For the purposes of drawing a representation of a scene as viewed from an imaginary camera, we are generally only interested in rays that reach that camera's lens.
A 'scene' is the virtual world which you wish to take a 'picture' of with our simulated camera. There can be (and usually are) objects in the scene that do not appear in the final image, just as objects outside the field of view of a real camera do not directly appear in the final image. (They can still cast shadows or be seen as reflections, though).
Accordingly, ray-tracing programs like POV-Ray start with their simulated camera and trace rays backwards out into the scene. The user specifies the location of the camera and the type of lens it is using, the light sources that illuminate the scene, the objects within it, as well as the surface texture properties of objects, their interiors (if transparent) and any atmospheric media such as fog, haze, or fire.
For every pixel in the final image one or more viewing rays are shot from the camera into the scene to see if it intersects with any of the objects in the scene. These "viewing rays" originate from the viewer (represented by the camera), and pass through the viewing window (representing the pixels of the final image).
Every time an object is hit, the color of the surface at that point is calculated. For this purpose rays are sent from that point to each light source to determine the amount of light coming from that source. These "shadow rays" are tested to tell whether the surface point lies in shadow or not. If the surface is reflective or transparent new rays are set up and traced in order to determine the contribution of the reflected and refracted light to the final surface color.
Special features like inter-diffuse reflection (radiosity), atmospheric effects and area lights make it necessary to shoot a lot of additional rays into the scene for every pixel.
What is POV-Ray?
POV-Ray™ is short for the Persistence of Vision Raytracer™, a tool for producing high-quality computer graphics. POV-Ray is Free Software (as per the definition of the Free Software Foundation) as its source code is licensed under the Affero General Public License (AGPL).
POV-Ray was developed from DKBTrace 2.12 (written by David K. Buck and Aaron A. Collins) by a bunch of people (called the POV-Team™) in their spare time. The headquarters of the POV-Team is on the internet (see Where to Find POV-Ray Files for more details).
The POV-Ray package includes detailed instructions on using the ray-tracer and creating scenes. Many stunning scenes are included with POV-Ray so you can start creating images immediately when you get the package. These scenes can also be modified so you do not have to start from scratch.
In addition to the pre-defined scenes, a library of pre-defined shapes and materials is provided. You can include these shapes and materials in your own scenes by just including the library file name at the top of your scene file, and by using the shape or material name in your scene.
Here are some highlights of POV-Ray's features:
- Easy to use scene description language.
- Large library of stunning example scene files.
- Standard include files that pre-define many shapes, colors and textures.
- Very high quality output image files (up to 48-bit color).
- Create landscapes using smoothed height fields.
- Many camera types, including perspective, orthographic, fisheye, etc.
- Spotlights, cylindrical lights and area lights for sophisticated lighting.
- Photons for realistic, reflected and refracted, caustics. Photons also interact with media.
- Phong and specular highlighting for more realistic-looking surfaces.
- Inter-diffuse reflection (radiosity) for more realistic lighting.
- Atmospheric effects like atmosphere, ground-fog and rainbow.
- Particle media to model effects like clouds, dust, fire and steam.
- Several image file output formats including BMP, PNG, JPG and OpenEXR.
- Basic shape primitives such as:
- Advanced shape primitives such as:
- tori (donuts)
- bezier patches
- height fields (mountains)
- smooth triangles
- surface of revolution
- Shapes can easily be combined to create new complex shapes using Constructive Solid Geometry.
- POV-Ray supports unions, merges, intersections and differences.
- Objects are assigned materials called textures and interior properties such as index of refraction and particle media.
- Built-in color and normal patterns:
- Users can create their own textures or use the pre-defined ones included with the distribution.
- Combine textures using layering of semi-transparent textures or tiles of textures or material map files.
- Display preview of image while rendering (on supported platforms).
- Halt and save a render part way through, and continue rendering the halted partial render later.
Changes and New Features Summary
The following sections cover changes and new features that apply no matter what platform you are using. Changes and information pertaining to your particular installation are covered in the platform specific documentation that's included with the distribution.
The categorized lists below outline the additions, changes and improvements along with links (when appropriate) to their relevant passages in the Reference Section.
These changes (in no particular order) pertain to the version 3.8 release.
- For clarity and ease of maintenance, several new annotations now appear in the documentation. See: Notation and Basic Assumptions
- Bug tracking is now handled by the issue tracker on GitHub
- Animation status messages now include the nominal frame number
Language Basics and Directives
- Identifiers are no longer limited to just 40 characters in length
- Support for
tauas a Built-in Constant has been added
macrodirective has been extended. See Optional Parameters for details
- A cached macro mechanism has been implemented. See: Macro Caching for more information
arrayfunctionality allows the creation of dictionary container types
- The addition of a
Create_Continue_Trace_Logoption allows for greater resource control
- The Declare and Local Directives have been extended to support tuple-style assignments
- All instances of
grayin keywords or INI file options can now alternatively be spelled
- Trailing white-space in INI files no longer causes a warning
versionpseudo-variable will now evaluate to the effective language version at the time the expression is parsed. See: Built-in Variables and Version Directive
Patterns Pigments and Textures
- The default setting for
repeatoption has been added to Crackle Pattern
- The map entry upper limit restriction for Color Maps and Pigment Maps has been removed
- UV mapping support for the
lemonwas added and
ovusmapping has been improved
- A new finish parameter
use_alphahas been added to suppress highlights and reflections depending on pigment transparency
- Implemented a non-linear interpolation scheme for Color Maps and Pigment Maps
- A new special pigment pattern
user_definedhas been added to define the pigment color directly in terms of a set of functions
- A new pattern
potentialhas been added to aid in creating a pattern based on the potential field of a
- Fresnel angle-dependent attenuation can now also be applied to highlights and the diffuse component for more physical realism
- Radiosity now honors the
brilliancesetting of a surface
- CIELAB conversion macros have been added to
- RAL Classic standard predefined colors are now available
Images and Image Related
- The default
upvector has changed. See: Aspect Ratio
max_extentfunction has been extended
- Two gamma handling specifications have been added for:
- the display settings
- the output file
- image map input file
- image pattern input file
- height field input file
- bump map input file
map_typekeyword now supports the angular map projection for use with light probes
- Dithering is now fully supported for Radiance HDR output files
- Default gamma handling of NetPBM (PPM/PGM) output files now complies with the official NetBPM standard
- The compression setting now affects more file types. See: Output File Type
- The interaction of
filter allwith an image's alpha channel has been changed
Objects and Object Related
lemonobject was added
ovusobject has been extended and uv mapping has been improved
- Support for a spindle
- The number of components per
blobis no longer artificially limited
user_definedcamera type was added
- A new Light Fading model has been added
These version 3.7 items definitely deserve your attention, because some of them represent key changes or enhancements to the way POV-Ray operates or behaves.
- POV-Ray now supports Symmetric MultiProcessing.
- The addition of the
mesh_camerapermits simulation of arbitrary lenses and makes texture baking possible.
- An elaborate gamma handling feature has been added, some of the highlights are:
srgbkeyword and its kin can be used to specify gamma pre-corrected colors
File_Gammafeature has been added
Antialias_Gammafeature has been added
- lastly you can also change the input file
gammafor individual input files
- Make sure to review the Images and Image Related category below for important changes and additions.
- Redistribute the workload to render threads by specifying a render block size.
- Binary Space Partitioning or BSP tree bounding is now available.
- A resource control option for output image caching has been added.
- An overall review of the entire radiosity section is probably a good idea; some of the highlights are:
- a revised radiosity tutorial
- the new
- adaptive pretrace mode added to the
- the loading and saving of radiosity data has changed
- new command line options can help to further customize radiosity features
- The ovus object was added, along with support for
- Raised max order of the
quarticobjects. Alternate syntax is also available.
- Added multiple-thread support to photon shooting code.
- New thread-safe random number generator was added; this can cause slight differences in the render output.
- The buit-in benchmark process now runs without any other distribution files. See the platform specific documentation for details.
Light_Bufferoptions have been deprecated. Look here for additional details.
Patterns Pigments and Textures
This category deals with items that are the building blocks of materials and textures and their appearance.
diffusebackside illumination capability.
- An experimental subsurface scattering feature was added.
- Support for
area_lightdiffuse and specular illumination was implemented.
- These list patterns, a warp, and a slope pattern extensions were added:
- Improvements to
iterationsand two new
exteriortypes were added. See Fractal Patterns for more details.
- The finish block now supports the
sky_spherelayered pigment related behavior change.
- A new Slope Map Tutorial has been added.
- Re-enabled the crand
Images and Image Related
Image formats and handling issues are covered in this section.
- Get your display gamma correct! See the new
- There have been various changes regarding output file types these are the highlights:
- cross platform default output file type is PNG
- BOTH input and output support for two High Dynamic Range file types has been added
- JPEG default quality and chroma sub-sampling changes
- output file type "s" has been deprecated
- An output file dithering feature has been added.
interpolateoption now supports bicubic interpolation.
- Use of the
hf_gray_16keyword has been deprecated in the
- A couple of important changes and additions regarding Alpha Channel usage.
- Added "out-of-the-box" transparency support for GIF input files.
Language Basics and Directives
A macro, a few functions and some programming directives completes this summary.
- Now you can declare an identifier as
- Several bitwise functions were added.
- A string function
datetime()has also been added.
- Added a new pre-declared variable
- New string relational operators have been added.
- Added binary
#writecapability, see the
ARRAYS_WriteDF3macro for usage.
#breakdirective behavior has changed.
atandfunction has been added to the math.inc file.
max_extentfunction can now return the pixel resolution of an image map.
- A new
#versiondirective requirement has been added.
#ifdirective now supports an
- A new
#forloop directive has been added.
- The CPU Utilization Histogram feature has been deprecated.
- Added a
+GPoption. See the section: Directing Text Streams to Files for more information.
The terms 'POV-Ray', 'Persistence of Vision Ray Tracer', and 'POV-Team' are trademarks of Persistence of Vision Raytracer Pty. Ltd. All other trademarks are acknowledged as being the property of their respective owners.
The Early History of POV-Ray
Here's how POV-Ray came to be, as described by David Buck:
Back in 1986 or so, I had an Amiga. A friend who also has an Amiga downloaded the C code for a raytracer for Unix from the Internet and brought it over. I thought it looked interesting and I ported it to the Amiga and wrote the drivers to display it with Amiga graphics. The program only rendered untextured spheres with a planar floor in black and white, but I was still impressed by it. I played with it a bit adding support for color, but I eventually decided that I could do a better job writing a raytracer from scratch, so I scrapped the C program and started my own - DKBTrace had begun.
I decided to start with general quadric surfaces since they could represent spheres, ellipsoids, cylinders, planes, and more. I worked out the ray-quadric intersection calculations and used some calculus to work out the surface normal to a quadric surface at a point. For the program structure, I decided to use an object-oriented style since I had learned Smalltalk at university and it fit nicely. To make modeling more flexible, I added CSG and procedural textures. In the end, I had an interesting little raytracer and I decided to release it as freeware since I was planning to return to university to start my Master's degree and didn't have time to develop a commercial raytracer. Besides, there were already commercial renders for the Amiga that had user interfaces (not just text files) and I felt I couldn't sell it as a commercial product. I called it DKBTrace and released it to local BBS'es and to the Internet.
DKBTrace was an Amiga-only program, but it attracted quite a lot of interest. I released several versions of it adding in new features, better primitives, more texturing options, etc. Eventually I released version 2.01.
Sometime around 1987 or 1988, I was contacted by Aaron Collins. He had found the C code for DKBTrace and ported it to the PC. He also added a Phong lighting model and a few more goodies. I was interested in what he had done, so I contacted him to see if he wanted to help develop a new version of the program. This one would be portable across more platforms (at university I had access to Unix workstations). We eventually came up with version 2.12 which was the last version of DKBTrace ever released (1989).
While Aaron and I were working up to version 2.12, there was a group of people on CompuServe who were very excited about DKBTrace and were creating all sorts of neat scenes for it. They were also expressing frustration that Aaron and I weren't able to add new features into DKBTrace fast enough. They started talking about building a whole new raytracer from scratch that they could control and add the features they wanted. At that time, I was starting to pursue other areas and was starting to drift away from raytracing. So, I posted a message on CompuServe with the following offer: We could form a team to develop a new raytracer using DKBTrace as a base. I had three requirements for this team. The resulting code had to be freeware with the source code freely available, it had to remain portable between different platforms, and it had to have a different name than DKBTrace.
The name DKBTrace was, of course, based on my initials: David Kirk Buck (there's some little known trivia for you). With a package developed by a team of people, it was inappropriate to use my initials. I was also starting to drift away from raytracing (as I mentioned) and I didn't want people thinking that I was the head of the team forever. The name that was proposed was "Persistance Of Vision Raytracer" which was shortened to POV-Ray. It worked in three ways. It was the result of a persistent vision of the developers, it was a reference to the Salvador Dali work which depicted a distorted but realistic world, and the term "persistance of vision" in biology referred to the ability to see an image that was presented briefly - almost an after image.
In 1989, then, DKBTrace 2.12 was officially released and the POV-Ray project had begun. I worked with the team for a few years after that. I was responsible for the Amiga port among other things. Drew Wells was the project leader. Aaron Collins dropped out of the project around that time as well. Other early members included Chris Young, Steve Anger, Tim Wegner, Dan Farmer, Bill Pulver (IBM drivers), and Alexander Enzmann (quartics and cool math stuff). Chris Cason joined shortly after (my apologies if I left anyone out - lots of people were involved). The reference to Robert Skinner in the credits for POV-Ray was because we had a hard time finding a good noise function. In another raytracer, he had a great noise function written by Robert Skinner, so we asked for and received permission to use it in POV-Ray.
There was so much demand for us to release a new version that we created POV-Ray 0.5 and released it. It was basically an enhanced DKBTrace with a similar grammar but many more features. Eventually, we released POV-Ray 1.0 which had the new grammar and lots of new stuff. Drew dropped out later and Chris Young took over as project leader.
It was around that time that I started to drift away from the POV-Ray team. The project had momentum and could continue on without me. I was getting into different areas (physically based modeling and animation) and no longer had the time to continue with POV-Ray. Around the release of version 2.0, I left the project and the POV-Ray team developed it to its current state. Chris Cason is now the project leader.
Even though I'm no longer on the POV-Ray development team, I still like to follow its progress. I haven't built my own scene by hand for years now (although I occasionally use Moray). I still enjoy the one thing that drove me back in the DKBTrace days - I love seeing the works of other people who used my software. Even though I can no longer call POV-Ray "my software", I still enjoy admiring the artwork people create with it. I'm constantly amazed at what people can do. It was always the feedback from user community that drove me.
david [at] simberon.com
|Introduction||The Original Creation Message|
This document is protected, so submissions, corrections and discussions should be held on this documents talk page.