Section 4.8.4.7
Using Iridescence

Iridescence is what we see on the surface of an oil slick when the sun shines on it. The rainbow effect is created by something called thin-film interference (read section "Iridescence" for details). For now let's just try using it. Iridescence is specified by the irid keyword and three values: amount, thickness and turbulence. The amount is the contribution to the overall surface color. Usually 0.1 to 0.5 is sufficient here. The thickness affects the busyness of the effect. Keep this between 0.25 and 1 for best results. The turbulence is a little different from pigment or normal turbulence. We cannot set octaves, lambda or omega but we can specify an amount which will affect the thickness in a slightly different way from the thickness value. Values between 0.25 and 1 work best here too. Finally, iridescence will respond to the surface normal since it depends on the angle of incidence of the light rays striking the surface. With all of this in mind, let's add some iridescence to our glass sphere.

sphere { <0,0,0>, 1 pigment { White filter 1 } finish { ambient .1 diffuse .1 reflection .2 refraction 1 ior 1.5 specular 1 roughness .001 fade_distance 5 fade_power 1 caustics 1 irid { 0.35 thickness .5 turbulence .5 } } }

We try to vary the values for amount, thickness and turbulence to see what changes they make. We also try to add a normal block to see what happens.


Section 4.8.5
Halos

Important notice: The halo feature in POV-Ray 3.0 is somewhat experimental. There is a high probability that the design and implementation of these features will be changed in future versions. We cannot guarantee that scenes using these features in 3.0 will render identically in future releases or that full backwards compatibility of language syntax can be maintained.

Halos are a powerful feature that can be used to create a lot of different effects like clouds, fogs, fire, lasers, etc. The name actually comes from the ability to render halos with it, like the ones seen around the moon or the sun.

Due to the complexity of the halo feature and the large amount of parameters provided it is very difficult to get satisfying results. The following sections will help to create a halo step by step, starting with the basic things and going to the more subtle stuff.

It is also helpful to read the halo reference sections to get a better understanding of the halo feature. One should especially read the sections "Empty and Solid Objects" and "Halo Mapping" because they are essential for understanding halos.


Section 4.8.5.1
What are Halos?

Halos are a texture feature allowing us to fill the interior of an object with particles. The distribution of these particles can be modified using several density mappings and density functions. The particles can emit light to give fire- or laser-like effects or they can absorb light to create clouds or fog.

A halo is attached to an object, the so called container object, just like a pigment, normal or finish. The container object is completely filled by the halo but we will not see anything if we do not make sure that the object is hollow and the surface is translucent. How this is accomplished will be shown in the next section.

When working with halos we always have to keep in mind that the container object has to be hollow and translucent.


Section 4.8.5.2
The Emitting Halo

We start with one of the simpler types, the emitting halo. It uses particles that only emit light. There are no particles that absorb the light coming from other particles or light sources.

Section 4.8.5.2.1
Starting with a Basic Halo

A clever approach in designing a nice halo effect is to start with a simple, unit-sized shape that sits on the coordinate system's origin.

In the first example (halo01.pov) we try to create a fiery explosion, which the sphere is best suited for. We start with a simple scene consisting of a camera, a light source (we don't care about shadows so we add the shadowless keyword), a checkered plane and a unit-sized sphere containing the halo.

camera { location <0, 0, -2.5> look_at <0, 0, 0> } light_source { <10, 10, -10> color rgb 1 shadowless } plane { z, 2 pigment { checker color rgb 0, color rgb 1 } finish { ambient 1 diffuse 0 } scale 0.5 hollow } sphere { 0, 1 pigment { color rgbt <1, 1, 1, 1> } halo { emitting spherical_mapping linear color_map { [ 0 color rgbt <1, 0, 0, 1> ] [ 1 color rgbt <1, 1, 0, 0> ] } samples 10 } hollow }

We note that the sphere is set to be hollow and has a translucent surface (the transmittance channel in the pigment's color is 1), just like it is required for halos. We also note that the plane has a hollow keyword even though it has no halo. Why is this necessary?

The reason is quite simple. As described in section "Empty and Solid Objects" there can be no halo inside any other non-hollow object. Since the camera is inside the plane object, i. e. it is on the side of the plane that is considered to be inside, the halo will never be visible unless the plane is made hollow (or the negative keyword is added to bring the camera on the outside side of the plane).

What do all those halo keywords and values mean? At the beginning of the halo the emitting keyword is used to specify what type of halo we want to use. The emitting halo emits light. That is what is best suited for our fiery explosion.

The spherical_mapping and linear keywords need a more detailed explanation of how a halo works (this is also done in chapter "Halo" in more detail).

As noted above the halo is made up of lots of small particles. The distribution of these particles is described by a density function. In general, a density function tells us how much particles we'll find at a given location.

Instead of using an explicitly, mathematical density function, halos rely on a given set of density mappings and density functions to model a variety of particle distributions.

The first step in this model is the density mapping function that is used to map three-dimensional points onto a one-dimensional range of values. In our example we use a spherical mapping, i.e. we take the distance of a point from the center of the coordinate system. This is the reason why it is clever to start with a container object sitting on the coordinate system's center. Since all density mappings are made relative to this center we won't see anything if we start with an object sitting somewhere else. Moving the whole object (including textures and halos) to another location is the correct way of placing a container object.

Now we have a single value in the range from 0 to 1. This value will be transformed using a density function to get density values instead of distance values. Just using this single value won't work because we want to have particle distributions were the density decreases as we move from the center of the container object to the outside.

This is done by the density function. There are several alternatives available as described in the halo reference (see section "Density Function"). We use the simple linear function that just maps values between 0 and 1 onto a 1 to 0 range. Thus we get a density value of 1 at the center of our sphere and a value of 0 at its surface.

Now that we have a density function what do we do to see something? This is where the colour_map keyword comes into play. It is used to describe a color map that actually tells the program what colors are to be used for what density. The relation is quite simple: colors at the beginning of the color map (with small values) will be used for low density values and colors at the end of the map (high values) will be used for high densities. In our example the halo will be yellow at the center of the sphere where the density is greatest and it will blend to red at the surface of the sphere where the density approaches zero.

The transmittance channel of the colors in the color map is used to model the translucency of the density field. A value of 0 represents no translucency, i. e. that areas with the corresponding density will be (almost) opaque, while a value of 1 means (almost) total translucency.

In our example we use

color_map { [ 0 color rgbt <1, 0, 0, 1> ] [ 1 color rgbt <1, 1, 0, 0> ] }

which results in a halo with a very translucent, reddish outer area and a nearly opaque, yellowish inner areas as we can see after tracing the example image.


The basic halo used in modelling a fiery explosion.

There is one parameter that still needs to be explained: the samples keyword. This keyword tells POV-Ray how many samples have to be taken along any ray traveling through the halo to calculate its effect. Using a low value will result in a high tracing speed while a high value will lead to a low speed. The sample value has to be increased if the halo looks somewhat noisy, i. e. if some artifacts of the low sampling rate appear. For more details see section "Halo Sampling".

A good starting value for the number of samples is 10.


Next Section
Table Of Contents