Section 7.6.3.5.1
Light Attenuation

Light attenuation is used to model the decrease in light intensity as the light travels through a translucent object. Its syntax is:

finish { fade_distance FADE_DISTANCE fade_power FADE_POWER }

The fade_distance keyword determines the distance the light has to travel to reach half intensity while the fade_power keyword describes how fast the light will fall off. For realistic effects a fade power of 1 to 2 should be used.

The attenuation is calculated by a formula similar to that used for light source attenuation.

                                 1
  attenuation = -------
                 1 + (d / FADE_DISTANCE) ^ FADE_POWER

Section 7.6.3.5.2
Faked Caustics

The syntax is:

finish { caustics POWER }

***STILL BEING WRITTEN***


Section 7.6.3.6
Iridescence

Iridescence , or Newton's thin film interference, simulates the effect of light on surfaces with a microscopic transparent film overlay. The effect is like an oil slick on a puddle of water or the rainbow hues of a soap bubble (see also "irid_wavelength" ).

The syntax is:

finish { irid { AMOUNT thickness FLOAT turbulence VECTOR } }

This finish modifies the surface color as a function of the angle between the light source and the surface. Since the effect works in conjunction with the position and angle of the light sources to the surface it does not behave in the same ways as a procedural pigment pattern.

The AMOUNT parameter is the contribution of the iridescence effect to the overall surface color. As a rule of thumb keep to around 0.25 (25% contribution) or less, but experiment. If the surface is coming out too white , try lowering the diffuse and possibly the ambient values of the surface.

The thickness keyword represents the film's thickness. This is an awkward parameter to set, since the thickness value has no relationship to the object's scale. Changing it affects the scale or busy-ness of the effect. A very thin film will have a high frequency of color changes while a thick film will have large areas of color.

The thickness of the film can be varied with the turbulence keyword. You can only specify the amount of turbulence with iridescence. The octaves, lambda, and omega values are internally set and are not adjustable by the user at this time.

In addition, perturbing the object's surface normal through the use of bump patterns will affect iridescence.

For the curious, thin film interference occurs because, when the ray hits the surface of the film, part of the light is reflected from that surface, while a portion is transmitted into the film. This subsurface ray travels through the film and eventually reflects off the opaque substrate. The light emerges from the film slightly out of phase with the ray that was reflected from the surface.

This phase shift creates interference, which varies with the wavelength of the component colors, resulting in some wavelengths being reinforced, while others are cancelled out. When these components are recombined, the result is iridescence.

The concept used for this feature came from the book Fundamentals of Three-Dimensional Computer Graphics by Alan Watt (Addison-Wesley).


Section 7.6.4
Halo

A halo is used to simulate some of the atmospheric effects that occur when small particles interact with light or radiate on their own. Those effects include clouds, fogs, fire, etc.

Halos are attached to an object, the so called container object , which they completely fill. If the object is partially or completely translucent and the object is specified to be hollow (see section "Hollow" for more details) the halo will be visible. Thus the halo effects are limited to the space that the object covers. This should always be kept in mind.

What the halo actually will look like depends on a lot of parameters. First of all you have to specify which kind of effect you want to simulate. After this you need to define the distribution of the particles. This is basically done in two steps: a mapping function is selected and a density function is chosen. The first function maps world coordinates onto a one-dimensional interval while the later describes how this linear interval is mapped onto the final density values.

The properties of the particles, such as their color and their translucency, are given by a color map. The density values calculated by the mapping processes are used to determine the appropriate color using this color map.

A ray marching process is used to volume sample the halo and to accumulate the intensities and opacity of each interval.

The following sections will describe all of the halo parameters in more detail. The complete halo syntax is given by:

halo { attenuating | emitting | glowing | dust [ constant | linear | cubic | poly ] [ planar_mapping | spherical_mapping | cylindrical_mapping | box_mapping ] [ dust_type DUST_TYPE ] [ eccentricity ECCENTRICITY ] [ max_value MAX_VALUE ] [ exponent EXPONENT ] [ samples SAMPLES ] [ aa_level AA_LEVEL ] [ aa_threshold AA_THRESHOLD ] [ jitter JITTER ] [ turbulence <TURBULENCE> ] [ octaves OCTAVES ] [ omega OMEGA ] [ lambda LAMBDA ] [ colour_map COLOUR_MAP ] [ frequency FREQUENCY ] [ phase PHASE ] [ scale <VECTOR> ] [ rotate <VECTOR> ] [ translate <VECTOR> ] }

Section 7.6.4.1
Halo Mapping

As described above the actual particle distribution and halo appearance is influenced by a lot of parameters. The steps that are performed during the halo calculation will be explained below. It will also be noted where the different halo keywords will have an effect on the calculations.

1. Depending on the current sampling position along the ray, point P (coordinates x, y, z) inside the halo container object is calculated. The actual location is influenced by the jitter keyword, the number of samples and the use of anti-aliasing ( aa_level and aa_threshold).
2. Point P is transformed into point Q using the (current) halo's transformation. Here all local halo transformations come into play, i.e. all transformations specified inside the (current) halo statement.
3. Turbulence is added to point Q. The amount of turbulence is given by the urbulence keyword. The turbulence calculation is influenced by the octaves, omega and lambda keywords.
4. Radius r is calculated depending on the specified density mapping ( planar_mapping, spherical_mapping, cylindrical_mapping, box_mapping). The radius is clipped to the range from 0 to 1, i.e. 0 <= r <= 1.
5. The density d is calculated from the radius r using the specified density function ( constant, linear, cubic, poly) and the maximum value given by max_value. The density will be in the range from 0 to max_value.
6. The density d is first multiplied by the frequency value, added to the phase value and clipped to the range from 0 to 1 before it is used to get the color from the color_map . If an attenuating halo is used the color will be determined by the total density along the ray and not by the sum of the colors for each sample.

All steps are repeated for each sample point along the ray that is inside the halo container object. Steps 2 through 6 are repeated for all halos attached to the halo container object.

It should be noted that in order to get a finite particle distribution, i. e. a particle distribution that vanishes outside a finite area, a finite density mapping and a finite density function has to be used.

A finite density mapping gives the constant value one for all points outside a finite area. The box and spherical mappings are the only finite mapping types.

A finite density function vanishes for all parameter values above one (there are no negative parameter values). The only infinte density function is the constant function.

Finite particle distributions are especially useful because they can always be transformed to stay inside the halo container object. If particles leave the container object they become invisible and the surface of the container will be visible due to the density discontiniuty at the surface.


Section 7.6.4.2
Multiple Halos

It is possible to put more than one halo inside a container object. This is simply done by putting more than one halo statement inside the container object statement like:

sphere { 0, 1 pigment { Clear } halo { here comes halo nr. 1 } halo { here comes halo nr. 2 } halo { here comes halo nr. 3 } ... }

The effects of the different halos are added. This is in fact similar to the CSG union operation.

You should note that currently multiple attenuating halos will use the color map of the last halo only. It is not possible to use different color maps for multiple attenuating halos.


Section 7.6.4.3
Halo Type

The type of the halo is defined by one of the following mutually exclusive keywords (if more than one is specified the last will be used). The default is attenuating .

halo { attenuating | emitting | glowing | dust }

The halo type determines how the light will interact with the particles inside the container object. There are two basic categories of light interaction: self-illuminated and illuminated. The first type includes the attenuating , emitting and glowing effects while the dust effect is of the second type.

The four types will be covered in detail in the next sections.


Section 7.6.4.3.1
Attenuating

The attenuating halo that only absorbs light passing through it is rendered by accumulating the particle density along a ray. The total halo color is determined from the total, accumulated density and the specified color map (see section "Halo Color Map" for details about the color map). The background light, i. e. the light passing through the halo, is attenuated by the total density and added to the total halo color to get the final color of the halo.

This model is suited to render particle distributions with a high albedo because the final color does not depend on the transparency of single volume elements but only on the total transparency along the ray. The albedo of a particle is given by the amount of light scattered by this particle in all directions in relation to the amount of incoming light. If the particle doesn't absorb any light the albedo is one.

Clouds and steams are two of the effects that can be rendered quite realistic by adding enough turbulence.


Section 7.6.4.3.2
Dust

The dust halo consists of particles that do not emit any light. They only reflect and absorb incoming light. Its syntax is:

halo { dust [ dust_type DUST_TYPE ] [ eccentricity ECCENTRICITY ] }

As the ray marches through the dust all light coming from any light sources is accumulated and scattered according to the dust type and the current dust density. Since this light accumulation includes a test for occlusion, other objects may cast shadows into the dust.

The same scattering types that are used with the atmosphere in section "Atmosphere" can be used with the dust (the default type is isotropic scattering). They are:

#declare ISOTROPIC_SCATTERING = 1 #declare MIE_HAZY_SCATTERING = 2 #declare MIE_MURKY_SCATTERING = 3 #declare RAYLEIGH_SCATTERING = 4 #declare HENYEY_GREENSTEIN_SCATTERING = 5

The Henyey-Greenstein function needs the additional parameter eccentricity that is described in the section about atmosphere. This keyword only applies to dust type 5, the Henyey-Greenstein scattering.


Section 7.6.4.3.3
Emitting

Emitting halos only emit light. Every particle is a small light source that emits some light. This light is not attenuated by the other particles because they are assumed to be very small.

As the ray travels through the density field of an emitting halo the color of the particles in each volume element and their differential transparency is determined from the color map. These intensities are accumulated to get the total color of the density field. This total intensity is added to the light passing through the halo. The background light is attenuated by the total density of the halo.

Since the emitted light is not attenuated it can be used to model effects like fire, explosions, light beams, etc. By choosing a well suited color map those effects can be rendered with a high degree of realism.

Fire is best modeled using planar mapping. Spherical mapping and high turbulence values can be used to create explosions (it's best to use a periodic color map and frequencies larger than one).

Emitting halos do not cast any light on other objects like light sources do, even though they are made up of small, light-emitting particles. In order to make them actually emit light hundreds or thousands of small light sources would have to be used. This would slow down tracing by a degree that would make it useless.


Section 7.6.4.3.4
Glowing

The glowing halo is similar to the emitting halo. The difference is that the light emitted by the particles is attenuated by the other particles. This can be seen as a combination of the attenuating and the emitting model.

Section 7.6.4.4
Density Mapping

The density mapping is used to map points in space onto a linear, one-dimensional interval between 0.0 and 1.0, thus describing the appearance of the three-dimensional particle distribution. The different mapping types are specified by:

halo { planar_mapping | spherical_mapping | cylindrical_mapping | box_mapping }

The default mapping type is planar mapping.

Since the mapping takes place in relation to the origin of the world coordinate system the following rule must always be kept in mind: Halo container objects ought to be unit sized objects centered at the origin . They can be transformed later to suit the individuals needs.

The different mapping types are explained in more detail in the following sections.


Section 7.6.4.4.1
Box Mapping

The box mapping can be used to create a box-shaped particle distribution. The mapping is calculated by getting the maximum of the absolute values of each coordinate as given by the formula:

r(x, y, z) = max(abs(x), abs(y), abs(z))

Values larger than one are clipped to one.


Section 7.6.4.4.2
Cylindrical Mapping

The distance r(x,y,z) from the y-axis given by

r(x, y, z) = sqrt(x*x + z*z)

is used to get the interval values. Values larger than one are clipped to one.


Section 7.6.4.4.3
Planar Mapping

The distance r(x,y,z) from the x-z-plane given by

r(x, y, z) = abs(y)

is used to get the interval values. Values larger than one are clipped to one.


Section 7.6.4.4.4
Spherical Mapping

The distance r(x,y,z) from the origin given by

r(x, y, z) = sqrt(x*x + y*y + z*z)

is used to get the interval values. Values larger than one are clipped to one.


Section 7.6.4.5
Density Function

The density function determines how the actual density values are calculated from the linear, one-dimensional interval that resulted from the density mapping.

The density function is specified by the following keywords:

halo { [ constant | linear | cubic | poly ] [ max_value MAX_VALUE ] [ exponent EXPONENT ] }

The exponent keyword is only used together with the poly density function.

The individual functions f(r) are described in the following sections. They all map the value r(x,y,z) calculated by the density mapping onto a suitable density range between 0 and MAX_VALUE (specified with the keyword max_value) .


Next Section
Table Of Contents