Section 4.8.5.5
The Dust Halo

The dust halo is a very complex halo type. It allows you to see the interaction of light coming from light sources with the particles in the halo. Those particles do absorb light like the attenuating halo. In addition they scatter light coming from light sources passing through them. This makes beams of light and shadows cast by objects onto the halo become visible.

Section 4.8.5.5.1
Starting With an Object Lit by a Spotlight

We start with a box shaped object that is lit by a spotlight. We don't use any halo at this moment because we want to see if the object is completely lit by the light source ( halo31.pov ).

camera { location <0, 0, -2.5> look_at <0, 0, 0> } background { color rgb <0.2, 0.4, 0.8> } light_source { <2.5, 2.5, -2.5> colour rgb <1, 1, 1> spotlight point_at <0, 0, 0> radius 12 falloff 15 tightness 1 } difference { box { -1, 1 } box { <-1.1, -0.8, -0.8>, <1.1, 0.8, 0.8> } box { <-0.8, -1.1, -0.8>, <0.8, 1.1, 0.8> } box { <-0.8, -0.8, -1.1>, <0.8, 0.8, 1.1> } pigment { color rgb <1, 0.2, 0.2> } scale 0.5 rotate 45*y rotate 45*x }


The object we want to use.

As you see the whole object is lit by the light source. Now we can start to add some dust.


Section 4.8.5.5.2
Adding Some Dust

We use a box to contain the dust halo. Since we use a constant density function it doesn't matter what kind of density mapping is used. The density has the value specified by the max_value keyword everywhere inside the halo (the default value is one). The isotropic scattering is selected with dust_type .

box { -1, 1 pigment { colour rgbt <1, 1, 1, 1> } halo { dust dust_type 1 box_mapping constant colour_map { [ 0 color rgbt <1, 1, 1, 1> ] [ 1 color rgbt <1, 1, 1, 0> ] } samples 10 } hollow scale 5 }


This dust is too thick.

The result of halo32.pov is too bright. The dust is too thick and we can only see some parts of the object and no background.


Section 4.8.5.5.3
Decreasing the Dust Density

The density inside the halo has the constant value one. This means that only the color map entry at position one is used to determine the density and color of the dust.

We use a transmittance value of 0.7 to get a much thinner dust.

box { -1, 1 pigment { colour rgbt <1, 1, 1, 1> } halo { dust dust_type 1 box_mapping constant colour_map { [ 0 color rgbt <1, 1, 1, 1.0> ] [ 1 color rgbt <1, 1, 1, 0.7> ] } samples 10 } hollow scale 5 }


A thinner dust looks much better.

Beside the ugly aliasing artefacts the image looks much better. We can see the whole object and even the background is slightly visible ( halo33.pov ).


Section 4.8.5.5.4
Making the Shadows Look Good

In order to reduce the aliasing artefacts we use three different techniques: jittering, super-sampling and an increased overall sampling rate.

The jittering is used to add some randomness to the sampling points making the image look more noisy. This helps because the regular aliasing artefacts are more annoying than noise. A low jitter value is a good choice.

The super-sampling tries to detect fine features by taking additional samples in areas of high intensity changes. The threshold at which super-sampling is used and the maximum recursion level can be specified using the aa_threshold and aa_level keywords.

The approach that always works is to increase the overall sampling rate. Since this is also the slowest method you should always try to use the other methods first. If they don't suffice you'll have to increase the sampling rate.

We use the following halo to reduce the aliasing artefacts ( halo34.pov ).

box { -1, 1 pigment { colour rgbt <1, 1, 1, 1> } halo { dust dust_type 1 box_mapping constant colour_map { [ 0 color rgbt <1, 1, 1, 1.0> ] [ 1 color rgbt <1, 1, 1, 0.7> ] } samples 50 aa_level 3 aa_threshold 0.2 jitter 0.1 } hollow scale 5 }


Different anti-aliasing methods help to get a satisfying result.

The image looks much better now. There are hardly any aliasing artefacts left.

The same parameters we have used are discussed in the section about the atmosphere feature (see "The Atmosphere" for further explanations).


Section 4.8.5.5.5
Adding Turbulence

The major difference between the halo's dust and the atmosphere described in "The Atmosphere" is the ability to choose a non-uniform particle distribution for the dust. This includes the fact that the halo is limited to a container object as well as the different density mappings and functions.

Another interesting way of getting an irregular disribution is to add some turbulence to the dust. This is done with the turbulence keyword followed by the amount of turbulence to use, like the following example shows ( halo35.pov ).

box { -1, 1 pigment { colour rgbt <1, 1, 1, 1> } halo { dust dust_type 1 box_mapping linear turbulence 1 colour_map { [ 0 color rgbt <1, 1, 1, 1.0> ] [ 1 color rgbt <1, 1, 1, 0.5> ] } samples 50 aa_level 3 aa_threshold 0.2 jitter 0.1 } hollow scale 5 }


Adding turbulence to the dust makes it much more interesting.

The image we now get looks much more interesting due to the shifts in the particle density.

You should note that we use a linear density function instead of the previous constant one. This is necessary because with a constant density function the density has the same value everywhere. Adding turbulence would have no effect because wherever the points are moved the density will have this same value. Only a non-constant density distribution makes sense when turbulence is added.

The fact that the turbulence value is actually a vector can be used to create effects like waterfalls by using a large turbulence value in on direction only (e.g. turbulence <0.2, 1, 0.2> ).


Section 4.8.5.5.6
Using a Coloured Dust

If you want to create a colored dust you can easily do this by using a non-white color in the halo's color map. In this case you'll also have to set the filter channels in the color map to non-zero values to specify the amount of light that will be filtered by the dust's color.

Use the following color map to get a partially filtering, red dust for example:

colour_map { [ 0 color rgbft <1, 0, 0, 0.5, 1.0> ] [ 1 color rgbft <1, 0, 0, 0.5, 0.7> ] }

Section 4.8.5.6
Halo Pitfalls

Due to the complexity of the halo feature and the few experiences people have made so far there are a lot of things still to discover.

Some of the most common problems and pitfalls are described below in order to help you to avoid the most common problems.


Section 4.8.5.6.1
Where Halos are Allowed

As mentioned above a halo completly fills the interior of an object. Keeping this in mind it is reasonable that the following example does not make sense.

sphere { 0, 1 pigment { checker texture { pigment { color Clear } halo { ... } } texture { pigment { color Red } } } hollow }

What's wrong with this example? It's simply that a halo is used to describe the interior of an object and that you cannot describe this interior by describing how the surface of the object looks like. But that's what was done in the example above. Can you imagine what the interior of the sphere will look like? Will it be filled completey with the halo? Will there be areas filled by the halo and some filled by air? How will those areas look like?

You won't be able to tell the interior's properties from looking at the surface. It's just not possible. This should always be kept in mind.

If the above example was meant to create a sphere filled with a halo and covered with a checker board pattern that partially hid the halo you would have used the following syntax:

sphere { 0, 1 pigment { checker texture { pigment { color Clear } } texture { pigment { color Red } } } halo { ... } hollow }

A halo is always applied to an object in the following way:

OBJECT { texture { pigment { ... } normal { ... } finish { ... } halo { ... } } hollow }

There's no halo allowed inside any pigment statement, color map, pigment map, texture map, material map, or whatever. You are not hindered to do this but you will not get what you want.

You can use a halo with a layered textures as long as you make sure that the halos are only attached to the lowest layer (this layer has to be partially transparent to see the halo of course).


Section 4.8.5.6.2
Overlapping Container Objects

POV-Ray is not able to handle overlapping container objects correctly. If you create two overlapping spheres that contain a halo you won't get correct results where the spheres overlap. The halo effect is calculated independently for each sphere and the results are added.

If you want to add different halos you have to put all halos inside a single container object to make sure the halo is calculated correctly (see also "Multiple Halos" ).

You should also note non-overlapping, stacked halo containers are handled correctly. If you put a container object in front of another container object the halos are rendered correctly.


Section 4.8.5.6.3
Multiple Attenuating Halos

It is currently not possible to use mutliple attenuating halos with different color maps. The color map of the last halo will be used for all halos in the container object.

Section 4.8.5.6.4
Halos and Hollow Objects

In order to correctly render halo effects you have to make sure that all objects the camera is inside are hollow. This is done by adding the hollow keyword.

For a detailed explanation see "Empty and Solid Objects" .


Section 4.8.5.6.5
Scaling a Halo Container

If you scale a halo container object you should keep in mind that it makes a great difference where you place the scale keyword.

Scaling the object before the halo statement will only scale the container object not the halo. This is useful if you want to avoid that the surface of the container object becomes visible due to the use of turbulence. As you've learned in the sections above particles may move out of the container object - where they are invisible - if turbulence is added. This only works for spherical and box mapping because the density fields described by the other mapping types don't have finite dimensions.

If the scale keyword is used after the halo statement both, the halo and the container object, are scaled. This is useful to scale the halo to your needs.

The halo keeps its appearance regardless of the transformations applied to the container object (after the halo), i.e. the halo's translucency, color and turbulence characteristics will not change.


Section 4.8.5.6.6
Choosing a Sampling Rate

Normally you'll start with a low sampling rate and you'll only increase it if any aliasing artefacts turn up (and don't vanish by using super-sampling and jittering).

The halo's appearance is independent from the sampling rate as long as there are enough samples to get a good estimate of what the halo really looks like. This means that one or two samples are hardly ever enough to determine the halo's appearance. As you increase the number of samples the halo will quickly approach its real appearance.

To put it in a nutshell, the halo will not change its appearance with the sample rate as long as you have a sufficient number of samples and no aliasing artefacts occur.


Section 4.8.5.6.7
Using Turbulence

As noted in one of the above sections turbulence will have no effect if the constant density function is used (keyword constant). It doesn't matter how much or where you move a point if the density is constant and thus does not depend on the points location. You'll get the same density value for all location.

Whenever you add turbulence to a halo do not use the constant density function.


Section 4.9
Using Atmospheric Effects

POV-Ray offers a variety of atmospheric effects, i. e. features that affect the background of the scene or the air by which everything is surrounded.

It is easy to assign a simple color or a complex color pattern to a virtual sky sphere. You can create anything from a cloud free, blue summer sky to a stormy, heavy clouded sky. Even starfields can easily be created.

You can use different kinds of fog to create foggy scenes. Multiple fog layers of different colors can add an eerie touch to your scene.

A much more realistic effect can be created by using an atmosphere, a constant fog that interacts with the light coming from light sources. Beams of light become visible and objects will cast shadows into the fog.

Last but not least you can add a rainbow to your scene.


Section 4.9.1
The Background

The background feature is used to assign a color to all rays that don't hit any object. This is done in the following way.

camera { location <0, 0, -10> look_at <0, 0, 0> } background { color rgb <0.2, 0.2, 0.3> } sphere { 0, 1 pigment { color rgb <0.8, 0.5, 0.2> } }

The background color will be visible if a sky sphere is used and if some translucency remains after all sky sphere pigment layers are processed.


Section 4.9.2
The Sky Sphere

The sky sphere can be used to easily create a cloud covered sky, a nightly star sky or whatever sky you have in mind.

In the following examples we'll start with a very simple sky sphere that will get more and more complex as we add new features to it.


Section 4.9.2.1
Creating a Sky with a Color Gradient

Beside the single color sky sphere that is covered with the background feature the simplest sky sphere is a color gradient.

You may have noticed that the color of the sky varies with the angle to the earth's surface normal. If you look straight up the sky normally has a much deeper blue than it has at the horizon.

We want to model this effect using the sky sphere as shown in the scene below ( skysph1.pov ).

#include "colors.inc" camera { location <0, 1, -4> look_at <0, 2, 0> angle 82 } light_source { <10, 10, -10> White } sphere { 2*y, 1 pigment { color rgb <1, 1, 1> } finish { ambient 0.2 diffuse 0 reflection 0.6 } } sky_sphere { pigment { gradient y color_map { [0 color Red] [1 color Blue] } scale 2 translate -1 } }

The interesting part is the sky sphere statement. It contains a pigment that describe the look of the sky sphere. We want to create a color gradient along the viewing angle measured against the earth's surface normal. Since the ray direction vector is used to calculate the pigment colors we have to use the y-gradient.

The scale and translate transformation are used to map the points derived from the direction vector to the right range. Without those transformations the pattern would be repeated twice on the sky sphere. The scale statement is used to avoid the repetition and the translate -1 statement moves the color at index zero to the bottom of the sky sphere (that's the point of the sky sphere you'll see if you look straight down).

After this transformation the color entry at position 0 will be at the bottom of the sky sphere, i. e. below us, and the color at position 1 will be at the top, i. e. above us.

The colors for all other positions are interpolated between those two colors as you can see in the resulting image.


A simple gradient sky sphere.

If you want to start one of the colors at a specific angle you'll first have to convert the angle to a color map index. This is done by using the formula

  color_map_index = (1 - cos(angle)) / 2

where the angle is measured against the negated earth's surface normal. This is the surface normal pointing towards the center of the earth. An angle of 0 degrees describes the point below us while an angle of 180 degrees represents the zenith.

In POV-Ray you first have to convert the degree value to radian values as it is shown in the following example.

sky_sphere { pigment { gradient y color_map { [(1-cos(radians( 30)))/2 color Red] [(1-cos(radians(120)))/2 color Blue] } scale 2 translate -1 } }

This scene uses a color gradient that starts with a red color at 30 degrees and blends into the blue color at 120 degrees. Below 30 degrees everything is red while above 120 degrees all is blue.


Next Section
Table Of Contents