Section 4.8.4
Finishes

The final part of a POV-Ray texture is the finish . It controls the properties of the surface of an object. It can make it shiny and reflective, or dull and flat. It can also specify what happens to light that passes through transparent pigments, what happens to light that is scattered by less-than-perfectly-smooth surfaces, and what happens to light that is reflected by surfaces with thin-film interference properties. There are twelve different properties available in POV-Ray to specify the finish of a given object. These are ambient , diffuse , brilliance , phong , specular , metallic , reflection , refraction , caustics , attenuation , crand , and iridescence . Let's design a couple of textures that make use of these parameters.

Section 4.8.4.1
Using Ambient

Since objects in POV-Ray are illuminated by light sources, the portions of those objects that are in shadow would be completely black were it not for the first two finish properties, ambient and diffuse . Ambient is used to simulate the light that is scattered around the scene that does not come directly from a light source. Diffuse determines how much of the light that is seen comes directly from a light source. These two keywords work together to control the simulation of ambient light. Let's use our gray sphere to demonstrate this. Let's also change our plane back to its original green and white checkered pattern.

plane {y,-1.5 pigment {checker Green, White} } sphere { <0,0,0>, 1 pigment {Gray75} finish { ambient .2 diffuse .6 }

In the above example, the default values for ambient and diffuse are used. Render this to see what the effect is and then make the following change to the finish.

ambient 0 diffuse 0

The sphere is black because we have specified that none of the light coming from any light source will be reflected by the sphere. Let's change diffuse back to the default of 0.6.

Now we see the gray surface color where the light from the light source falls directly on the sphere but the shaded side is still absolutely black. Now let's change diffuse to 0.3 and ambient to 0.3.

The sphere now looks almost flat. This is because we have specified a fairly high degree of ambient light and only a low amount of the light coming from the light source is diffusely reflected towards the camera. The default values of ambient and diffuse are pretty good averages and a good starting point. In most cases, an ambient value of 0.1 ... 0.2 is sufficient and a diffuse value of 0.5 ... 0.7 will usually do the job. There are a couple of exceptions. If you have a completely transparent surface with high refractive and/or reflective values, low values of both ambient and diffuse may be best. Here is an example.

sphere { <0,0,0>, 1 pigment { White filter 1 } finish { ambient 0 diffuse 0 reflection .25 refraction 1 ior 1.33 specular 1 roughness .001 } } }

This is glass, obviously. Glass is a material that takes nearly all of its appearance from its surroundings. Very little of the surface is seen because it transmits or reflects practically all of the light that shines on it. See glass.inc for some other examples.

If you ever need an object to be completely illuminated independently of the lighting situation in a given scene, you can do this artificially by specifying an ambient value of 1 and a diffuse value of 0. This will eliminate all shading and simply give the object its fullest and brightest color value at all points. This is good for simulating objects that emit light like lightbulbs, and for skies in scenes where the sky may not be adequately lit by any other means.

Let's try this with our sphere now.

sphere { <0,0,0>, 1 pigment { White } finish { ambient 1 diffuse 0 } } }

Rendering this we get a blinding white sphere with no visible highlights or shaded parts. It would make a pretty good streetlight.


Section 4.8.4.2
Using Surface Highlights

In the glass example above, we noticed that there were bright little hotspots on the surface. This gave the sphere a hard, shiny appearance. POV-Ray gives you two ways to specify surface specular highlights. The first is called Phong highlighting . Usually, Phong highlights are described using two keywords: phong and phong_size . The float that follows phong determines the brightness of the highlight while the float following phong_size determines its size. Let's try this.

sphere { <0,0,0>, 1 pigment { Gray50 } finish { ambient .2 diffuse .6 phong .75 phong_size 25 } }

Rendering this we see a fairly broad, soft highlight that gives the sphere a kind of plastic appearance. Now let's change phong_size to 150. This makes a much smaller highlight which gives the sphere the appearance of being much harder and shinier.

There is another kind of highlight that is calculated by a different means called specular highlighting . It is specified using the keyword specular and operates in conjunction with another keyword called roughness . These two keywords work together in much the same way as phong and phong_size to create highlights that alter the apparent shininess of the surface. Let's try using specular in our sphere.

sphere { <0,0,0>, 1 pigment { Gray50 } finish { ambient .2 diffuse .6 specular .75 roughness .1 } } }

Looking at th result we see a broad, soft highlight similar to what we had when we used phong_size of 25. Change roughness to .001 and render again. Now we see a small, tight highlight similar to what we had when we used phong_size of 150. Generally speaking, specular is slightly more accurate and therefore slightly more realistic than phong but you should try both methods when designing a texture. There are even times when both phong and specular may be used on a finish.


Section 4.8.4.3
Using Reflection and Metallic

There is another surface parameter that goes hand in hand with highlights, reflection . Surfaces that are very shiny usually have a degree of reflection to them. Let's take a look at an example.

sphere { <0,0,0>, 1 pigment { Gray50 } finish { ambient .2 diffuse .6 specular .75 roughness .001 reflection .5 } } }

We see that our sphere now reflects the green and white checkered plane and the black background but the gray color of the sphere seems out of place. This is another time when a lower diffuse value is needed. Generally, the higher reflection is the lower diffuse should be. Try lowering the diffuse value to 0.3 and the ambient value to 0.1 and render again. That is much better. Let's make our sphere as shiny as a polished gold ball bearing.

sphere { <0,0,0>, 1 pigment { BrightGold } finish { ambient .1 diffuse .1 specular 1 roughness .001 reflection .75 } } }

That is very close but there is something wrong with the highlight. To make the surface appear more like metal the keyword metallic is used. Add it now to see the difference.

sphere { <0,0,0>, 1 pigment { BrightGold } finish { ambient .1 diffuse .1 specular 1 roughness .001 reflection .75 metallic } } }

We see that the highlight has taken on the color of the surface rather than the light source. This gives the surface a more metallic appearance.


Section 4.8.4.4
Using Refraction

Objects that are transparent allow light to pass through them. With some substances, the light is bent as it traves from one substance into the other because of the differing optical densities of the objects. This is called refraction . Water and glass both bend light in this manner so to create water or glass, POV-Ray gives you a way to specify refraction. This is done with the keywords refraction and ior . The amount of light that passes through an object is determined by the value of the filtering and/or transmittance channel in the pigment. You should use the refraction value only to switch refraction on or off using vaules of 1 or 0 respectively (or the boolean values on and off ). See section "Refraction" for a detailed explanation of the reasons.

The degree of refraction, i. e. the amount of bending that occurs, is given by the keyword ior , short for index of refraction . If you know the index of refraction of the substance you are trying to create, you may just use that. For instance, water is 1.33, glass is around 1.45 and diamond is 1.75. Let's return to the example of a glass sphere we used earlier.

sphere { <0,0,0>, 1 pigment { White filter 1 } finish { ambient 0 diffuse 0 reflection .25 refraction 1 ior 1.45 specular 1 roughness .001 } } }

Render this again and notice how the plane that is visible through the sphere is distorted and turned upside-down. This is because the light passing through the sphere is being bent or refracted to the degree specified. Try reducing ior to 1.25. Try increasing it to 1.75. Notice how the distortion changes.


Section 4.8.4.5
Light Attenuation and Caustics

Transparent objects can be made to cause the intensity of light passing through them to be reduced. In reality, this is due to impurities in scattering the light. Two float values determine the effect: fade_distance is the distance the light has to travel to reach one-half its original intensity and fade_power is the degree of falloff. Let's try an example of this.

sphere { <0,0,0>, 1 pigment { White filter 1 } finish { ambient .1 diffuse .1 reflection .15 refraction 1 ior 1.45 specular 1 roughness .001 fade_distance 5 fade_power 1 } }

This gives the sphere a slightly clouded look as if not all of the light was able to pass through it. For interesting variations of this texture, try lowering ior to 1.15 and raising reflection to 0.5.

One thing we do notice is that the shadow of the sphere is still the same old flat gray shadow we have had all along. If there is all this light refraction going on shouldn't there be something going on with the shadow as well? That something would be due to an effect known as caustics . POV-Ray cannot do caustics but it can fake them to some degree. This is an easy one. Simply add caustics 1 to the finish block and re-render to see the effect. What we see is a highlight in the shadow that simulates the effect of light passing through the sphere and being focused because of the curved surface. Remember that this is not real caustics, so changing other finish parameters like ior will not affect the caustic highlight. The faked caustic is limited to the area shadowed by the corresponding object.


Section 4.8.4.6
Using Iridescence

Iridescence is what you 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. You cannot set octaves , lambda or omega but you 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 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 } } }

Try varying the values for amount , thickness and turbulence to see what changes they make. Try adding a normal block to see what happens.


Section 4.8.5
Halos

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 you 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. You 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 you 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. This object is completely filled by the halo but you won't see anything if you 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 you 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.

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 }

You'll note that the sphere is set to be hollow and has a translucent surface (the transmittance channel in the pigment color is 1), just like it is required for halos. You'll 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 one the side of the plane that is considered 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's what's best suited for our fiery explosion.

The spherical_mapping and linear keyword need a more detailed explanation of how a halo work (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 you won't see anything if you 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 middle 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 have 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 you 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 along any ray travelling through the halo have to be taken to calculate the halo. 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 strange , 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