Section 4.9.4.4
Using a Coloured Atmosphere

You can assign a color to the atmosphere that gives you more control over the atmosphere's appearance. First of all the color is used to filter all light passing through it, wether it comes from light sources, relfected and refracted rays, or the background. The amount by which the passing light is filtered by the atmosphere's color is determined by the color's filter value. A value of 0 means that the light is not influenced by the atmosphere's color while a value of 1 means that all light will be filtered by the color.

If you want to create a reddish atmosphere for example, you can add the following line to the atmosphere statement used in the above example.

color rgbf <1, 0, 0, 0.25>

Just using rgb <1,0,0> does not work because the color's filter value will be zero and thus no light will be filtered by the color, i. e. no light will be multiplied with the color's RGB components.

The filter value of 0.25 means that 25% of the light passing through the atmosphere will be filtered by the red color and 75% will pass unfiltered.

The transmittance channel of the atmosphere's color is used to specify a minimum translucency. By default the transmittance channel is zero and thus there is no such minimum translucency. Using a positive value lets you determine the amount of background light that will always pass through the atmosphere, regardless of its thickness set by the distance keyword.

If you use e.g. a color of rgbt <0,0,0,0.3> with our room example you can make the blue background become visible. Until now it was hidden by the atmosphere.


Section 4.9.4.5
Atmosphere Tips

It is very difficult to get satisfying results when using the atmosphere feature. Some of the more common problems will be discussed in the next sections to help you to solve them (see also the FAQ section about the atmosphere in "Atmosphere Questions" ).

Section 4.9.4.5.1
Choosing the Distance and Scattering Parameters

The first difficult step is to choose a good distance and scattering value. You need to be able to control the visibility of the objects in the scene and the atmospheric effects.

The best approach is to choose the distance value first. This value determines the visibility of the objects in the scene regardless of atmospheric light scattering. It works in the same way as the distance value of the fog feature.

Since fog is very similar to the unlit atmosphere you can use a fog instead of an atmosphere to quickly choose a working distance value. If you do this with room scene we used earlier you would use the following fog statement instead of the atmosphere ( atmos4.pov ).

fog { distance 40 color rgb <0, 0, 0> }


A black fog can be used to get a working distance value for the atmosphere.

The black color is used to simulate the attenuation you'll get in those parts of the atmosphere scene lying in shadow.

If you want to use a colored atmosphere you'll have to use the same color for the fog as you want to use for the atmosphere, including the filter and transmittance channel values (see "Using a Coloured Atmosphere" and "Atmosphere" for an explanation of the atmosphere's color).

If you (roughly) want to simulate the appearance of those parts lit by a light source you can use the color of the atmosphere inside the fog statement instead.

After you are satisfied with the distance value you'll have to choose a scattering value. This value lets you fit the atmosphere's intensity to your needs. Starting with a value of one you have to increase the value if the atmosphere effects are hardly visible. If you don't see anything in the lit parts of the atmosphere you'll have to decrease the value.

You should be aware that you may have to use very small or very large values to get the desired results.


Section 4.9.4.5.2
Atmosphere and Light Sources

The best results are generated with spotlights and cylindrical light sources. They create nice beams of light and are fast to render because the atmospheric sampling takes only place inside the light cone of the spotlight or light cylinder of the cylindrical light.

If you want to add a light source that does not interact with the atmosphere you can use the atmosphere keyword inside the light source statement (see "Atmosphere Interaction" ). Just add atmosphere off .

By default the light coming from any light source will not be diminished by the atmosphere. Thus the highlights in your scene will normally be too bright. This can be changed with atmospheric_attenuation on .


Section 4.9.4.5.3
Atmosphere Scattering Types

The different scattering types listed in "Atmosphere" can be used to model different types of particles. This is something for you to experiment with.

The Rayleigh scattering is used for small particles like dust and smoke while the Mie scattering is used for fog.

If you ever saw the lighthouse scene in the movie Casper you'll know what effect the scattering type has. In this scene the beam of light coming from the lighthouse becomes visible while it points nearly towards the viewer. As it starts to point away from the viewer it vanishes. This behaviour is typical for miniscule water droplets as modeled by the Mie scattering.


Section 4.9.4.5.4
Increasing the Image Resolution

You have to be aware that you may have to increase the atmosphere sampling rate if you increase the resolution of the image. Otherwise some aliasing artefacts that were no visible at the lower resolution may become visible.

Section 4.9.4.5.5
Using Hollow Objects and Atmosphere

Whenever you use the atmosphere feature you have to make sure that all objects that ought to be filled with atmosphere are set to hollow using the hollow keyword.

Even though this is not obvious this holds for infinite and patch objects like quadrics, quartics, triangles, polygons, etc. Whenever you add one of those objects you should add the hollow keyword as long as you are not absolutely sure you don't need it. You also have to make sure that all objects the camera is inside are set to be hollow.

Whenever you get unexpected results you should check for solid objects and set them to be hollow.


Section 4.9.5
The Rainbow

The rainbow feature can be used to create rainbows and maybe other more strange effects. The rainbow is a fog like effect that is restricted to a cone-like volume.

Section 4.9.5.1
Starting With a Simple Rainbow

The rainbow is specified with a lot of parameters: the angle under which it is visible, the width of the color band, the direction of the incoming light, the fog-like distance based particle density and last not least the color map to be used.

The size and shape of the rainbow are determined by the angle and width keywords. The direction keyword is used to set the direction of the incoming light, thus setting the rainbow's position. The rainbow is visible when the angle between the direction vector and the incident light direction is larger than angle-width/2 and smaller than angle+width/2.

The incoming light is the virtual light source that is responsible for the rainbow. There needn't be a real light source to create the rainbow effect.

The rainbow is a fog-like effect, i.e. the rainbow's color is mixed with the background color based on the distance to the intersection point. If you choose small distance values the rainbow will be visible on objects, not just in the background. You can avoid this by using a very large distance value.

The color map is the crucial part of the rainbow since it contains all the colors that normally can be seen in a rainbow. The color of the innermost color band is taken from the color map entry 0 while the outermost band is take from entry 1. You should note that due to the limited color range any monitor can display it is impossible to create a real rainbow. There are just some colors that you cannot display.

The filter channel of the rainbow's color map is used in the same way as with fogs. It determines how much of the light passing through the rainbow is filtered by the color.

The following example shows a simple scene with a ground plane, three spheres and a somewhat exaggerated rainbow ( rainbow1.pov ).

#include "colors.inc" camera { location <0, 20, -100> look_at <0, 25, 0> angle 82 } background { color SkyBlue } plane { y, -10 pigment { colour Green } } light_source {<100, 120, 40> colour White} // declare rainbow's colours #declare r_violet1 = colour rgbf<1.0, 0.5, 1.0, 1.0> #declare r_violet2 = colour rgbf<1.0, 0.5, 1.0, 0.8> #declare r_indigo = colour rgbf<0.5, 0.5, 1.0, 0.8> #declare r_blue = colour rgbf<0.2, 0.2, 1.0, 0.8> #declare r_cyan = colour rgbf<0.2, 1.0, 1.0, 0.8> #declare r_green = colour rgbf<0.2, 1.0, 0.2, 0.8> #declare r_yellow = colour rgbf<1.0, 1.0, 0.2, 0.8> #declare r_orange = colour rgbf<1.0, 0.5, 0.2, 0.8> #declare r_red1 = colour rgbf<1.0, 0.2, 0.2, 0.8> #declare r_red2 = colour rgbf<1.0, 0.2, 0.2, 1.0> // create the rainbow rainbow { angle 42.5 width 5 distance 1.0e7 direction <-0.2, -0.2, 1> jitter 0.01 colour_map { [0.000 colour r_violet1] [0.100 colour r_violet2] [0.214 colour r_indigo] [0.328 colour r_blue] [0.442 colour r_cyan] [0.556 colour r_green] [0.670 colour r_yellow] [0.784 colour r_orange] [0.900 colour r_red1] } }

Some irregularity is added to the color bands using the jitter keyword.


A colorful rainbow.

The rainbow in our sample is much too bright. You'll never see a rainbow like this in reality. You can decrease the rainbow's colors by decreasing the RGB values in the color map.


Section 4.9.5.2
Increasing the Rainbow's Translucency

The result we have so far looks much too bright. Just reducing the rainbow's color helps but it's much better to increase the translucency of the rainbow because it is more realistic if the background is visible through the rainbow.

We can use the transmittance channel of the colors in the color map to specify a minimum translucency, just like we did with the fog. To get realistic results we have to use very large transmittance values as you can see in the following example ( rainbow2.pov ).

rainbow { angle 42.5 width 5 distance 1.0e7 direction <-0.2, -0.2, 1> jitter 0.01 colour_map { [0.000 colour r_violet1 transmit 0.98] [0.100 colour r_violet2 transmit 0.96] [0.214 colour r_indigo transmit 0.94] [0.328 colour r_blue transmit 0.92] [0.442 colour r_cyan transmit 0.90] [0.556 colour r_green transmit 0.92] [0.670 colour r_yellow transmit 0.94] [0.784 colour r_orange transmit 0.96] [0.900 colour r_red1 transmit 0.98] } }

The transmittance values increase at the outer bands of the rainbow to make it softly blend into the background.


A much more realistc rainbow.

The resulting image looks much more realistic than our first rainbow.


Section 4.9.5.3
Using a Rainbow Arc

Currently our rainbow has a circular shape, even though most of it is hidden below the ground plane. You can easily create a rainbow arc by using the arc_angle keyword with an angle below 360 degrees.

If you use arc_angle 120 for example you'll get a rainbow arc that abruptly vanishes at the arc's ends. This does not look good. To avoid this the falloff_angle keyword can be used to specify a region where the arc smoothly blends into the background.

As explained in the rainbow's reference section (see "Rainbow" ) the arc extends from -arc_angle/2 to arc_angle/2 while the blending takes place from -arc_angle/2 to -falloff_angle/2 and falloff_angle/2 to arc_angle/2. This is the reason why the falloff_angle has to be smaller or equal to the arc_angle .

In the following examples we use an 120 degrees arc with a 45 degree falloff region on both sides of the arc ( rainbow3.pov ).

rainbow { angle 42.5 width 5 arc_angle 120 falloff_angle 30 distance 1.0e7 direction <-0.2, -0.2, 1> jitter 0.01 colour_map { [0.000 colour r_violet1 transmit 0.98] [0.100 colour r_violet2 transmit 0.96] [0.214 colour r_indigo transmit 0.94] [0.328 colour r_blue transmit 0.92] [0.442 colour r_cyan transmit 0.90] [0.556 colour r_green transmit 0.92] [0.670 colour r_yellow transmit 0.94] [0.784 colour r_orange transmit 0.96] [0.900 colour r_red1 transmit 0.98] } }

The arc angles are measured against the rainbows up direction which can be specified using the up keyword. By default the up direction is the y-axis.


A rainbow arc.

We finally have a realistic looking rainbow arc.


Section 5
POV-Ray Reference

The reference section describes all command line options and INI file switches, the scene description language and all other features that are part of POV-Ray. It is supposed to be used as a reference for looking up things. It does not contain detailed explanations on how scenes are written or how POV-Ray is used. It just explains all features, their syntax, applications, limits, drawbacks, etc.

Section 6
POV-Ray Options

POV-Ray was originally created as a command-line program for operating systems without graphical interfaces, dialog boxes and pull-down menus. Most versions of POV-Ray still use command-line switches to tell it what to do. This documentation assumes you are using the command-line version. If you are using Macintosh, MS-Windows or other GUI versions, there will be dialog boxes or menus which do the same thing. There is system-specific documentation for each system describing the specific commands.

Section 6.1
Setting POV-Ray Options

There are two distinct ways of setting POV-Ray options: command line switches and INI file keywords. Both are explained in detail in the following sections.

Section 6.1.1
Command Line Switches

Command line switches consist of a + (plus) or - (minus) sign, followed by one or more alphabetic characters and possibly a numeric value. Here is a typical command line with switches.

POVRAY +Isimple.pov +V +W80 +H60

povray is the name of the program and it is followed by several switches. Each switch begins with a plus or minus sign. The +I switch with the filename tells POV-Ray what scene file it should use as input and +V tells the program to output its status to the text screen as it's working. The +W and +H switches set the width and height of the image in pixels. This image will be 80 pixels wide by 60 pixels high.

In switches which toggle a feature, the plus turns it on and minus turns it off. For example +P turns on the pause for keypress when finished option while -P turns it off. Other switches are used to specify values and do not toggle a feature. Either plus or minus may be used in that instance. For example +W 320 sets the width to 320 pixels. You could also use -W 320 and get the same results.

Switches may be specified in upper or lower case. They are read left to right but in general may be specified in any order. If you specify a switch more than once, the previous value is generally overwritten with the last specification. The only exception is the +L switch for setting library paths. Up to ten unique paths may be specified.

Almost all + / - switches have an equivalent option which can be used in an INI file which is described in the next section. A detailed description of each switch is given in the option reference section.


Next Section
Table Of Contents