3.5.2 Normal |
POV-Ray 3.6 for UNIX documentation 3.5.3 Finish |
3.5.4 Halo |
The finish properties of a surface can greatly affect its appearance. How does light reflect? What happens in
shadows? What kind of highlights are visible. To answer these questions you need a finish
.
The syntax for finish
is as follows:
FINISH: finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] } FINISH_ITEMS: ambient COLOR | diffuse Amount | brilliance Amount | phong Amount | phong_size Amount | specular Amount | roughness Amount | metallic [Amount] | reflection COLOR | crand Amount | conserve_energy BOOL_ON_OF | reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] }| irid { Irid_Amount [IRID_ITEMS...] } REFLECTION_ITEMS: COLOR_REFLECTION_MAX | fresnel BOOL_ON_OFF | falloff FLOAT_FALLOFF | exponent FLOAT_EXPONENT | metallic FLOAT_METALLIC IRID_ITEMS: thickness Amount | turbulence Amount
The FINISH_IDENTIFIER is optional but should proceed all other items. Any items after the FINISH_IDENTIFIER modify or override settings given in the FINISH_IDENTIFIER. If no identifier is specified then the items modify the finish values in the current default texture.
Note: transformations are not allowed inside a finish because finish items cover the entire surface uniformly. Each of the FINISH_ITEMS listed above is described in sub-sections below.
In earlier versions of POV-Ray, the refraction
, ior
, and caustics
keywords
were part of the finish
statement but they are now part of the interior
statement. They are
still supported under finish
for backward compatibility but the results may not be 100% identical to
previous versions. See "Why are Interior and Media Necessary?" for
details.
A finish
statement is part of a texture
specification. However it can be tedious to use a texture
statement just to add a highlights or other lighting properties to an object. Therefore you may attach a finish
directly to an object without explicitly specifying that it as part of a texture. For example instead of this:
object { My_Object texture { finish { phong 0.5 } } }
you may shorten it to:
object { My_Object finish { phong 0.5 } }
Doing so creates an entire texture
structure with default pigment
and normal
statements just as if you had explicitly typed the full texture {...}
around it.
Finish identifiers may be declared to make scene files more readable and to parameterize scenes so that changing a single declaration changes many values. An identifier is declared as follows.
FINISH_DECLARATION: #declare IDENTIFIER = FINISH | #local IDENTIFIER = FINISH
Where IDENTIFIER is the name of the identifier up to 40 characters long and FINISH is any valid finish
statement. See "#declare vs. #local" for information on identifier
scope.
The light you see in dark shadowed areas comes from diffuse reflection off of other objects. This light cannot be directly modeled using ray-tracing. However we can use a trick called ambient lighting to simulate the light inside a shadowed area.
Ambient light is light that is scattered everywhere in the room. It bounces all over the place and manages to light objects up a bit even where no light is directly shining. Computing real ambient light would take far too much time, so we simulate ambient light by adding a small amount of white light to each texture whether or not a light is actually shining on that texture.
This means that the portions of a shape that are completely in shadow will still have a little bit of their surface color. It is almost as if the texture glows, though the ambient light in a texture only affects the shape it is used on.
The ambient
keyword controls the amount of ambient light. Usually a single float value is specified
even though the syntax calls for a color. For example a float value of 0.3
gets promoted to the full
color vector <0.3,0.3,0.3,0.3,0.3>
which is acceptable because only the red, green and blue parts
are used.
The default value is 0.1 which gives very little ambient light. The value can range from 0.0 to 1.0. Ambient light
affects both shadowed and non-shadowed areas so if you turn up the ambient
value you may want to turn
down the diffuse
and reflection
values.
Note: that this method does not account for the color of surrounding objects. If you walk into a room that has red walls, floor and ceiling then your white clothing will look pink from the reflected light. POV-Ray's ambient shortcut does not account for this. There is also no way to model specular reflected indirect illumination such as the flashlight shining in a mirror.
You may color the ambient light using one of two methods. You may specify a color rather than a float after the ambient keyword in each finish statement. For example
finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient
You may also specify the overall ambient light source used when calculating the ambient lighting of an object using
the global ambient_light
setting. The formula is given by Ambient = Finish_Ambient *
Global_Ambient_Light_Source See section "Ambient Light" for
details.
When light reflects off of a surface the laws of physics say that it should leave the surface at the exact same angle it came in. This is similar to the way a billiard ball bounces off a bumper of a pool table. This perfect reflection is called specular reflection. However only very smooth polished surfaces reflect light in this way. Most of the time, light reflects and is scattered in all directions by the roughness of the surface. This scattering is called diffuse reflection because the light diffuses or spreads in a variety of directions. It accounts for the majority of the reflected light we see.
The keyword diffuse
is used in a finish
statement to control how much of the light coming
directly from any light sources is reflected via diffuse reflection. For example
finish { diffuse 0.7 }
means that 70% of the light seen comes from direct illumination from light sources. The default value is diffuse
0.6
.
The amount of direct light that diffuses from an object depends upon the angle at which it hits the surface. When
light hits at a shallow angle it illuminates less. When it is directly above a surface it illuminates more. The brilliance
keyword can be used in a finish
statement to vary the way light falls off depending upon the angle of
incidence. This controls the tightness of the basic diffuse illumination on objects and slightly adjusts the
appearance of surface shininess. Objects may appear more metallic by increasing their brilliance. The default value is
1.0. Higher values from 5.0 to about 10.0 cause the light to fall off less at medium to low angles. There are no
limits to the brilliance value. Experiment to see what works best for a particular situation. This is best used in
concert with highlighting.
Very rough surfaces, such as concrete or sand, exhibit a dark graininess in their apparent color. This is caused by
the shadows of the pits or holes in the surface. The crand
keyword can be added to a finish
to cause a minor random darkening in the diffuse reflection of direct illumination. Typical values range from crand
0.01
to crand 0.5
or higher. The default value is 0. For example:
finish { crand 0.05 }
This feature is carried over from the earliest versions of POV-Ray and is considered obsolete. This is because the grain or noise introduced by this feature is applied on a pixel-by-pixel basis. This means that it will look the same on far away objects as on close objects. The effect also looks different depending upon the resolution you are using for the rendering.
Note: this should not be used when rendering animations. This is the one of a few
truly random features in POV-Ray and will produce an annoying flicker of flying pixels on any textures animated with a crand
value. For these reasons it is not a very accurate way to model the rough surface effect.
Highlights are the bright spots that appear when a light source reflects off of a smooth object. They are a blend of specular reflection and diffuse reflection. They are specular-like because they depend upon viewing angle and illumination angle. However they are diffuse-like because some scattering occurs. In order to exactly model a highlight you would have to calculate specular reflection off of thousands of microscopic bumps called micro facets. The more that micro facets are facing the viewer the shinier the object appears and the tighter the highlights become. POV-Ray uses two different models to simulate highlights without calculating micro facets. They are the specular and Phong models.
Note: specular and Phong highlights are not mutually exclusive. It is possible to specify both and they will both take effect. Normally, however, you will only specify one or the other.
The phong
keyword in the finish
statement controls the amount of Phong highlighting on
the object. It causes bright shiny spots on the object that are the color of the light source being reflected.
The Phong method measures the average of the facets facing in the mirror direction from the light sources to the viewer.
Phong's value is typically from 0.0 to 1.0, where 1.0 causes complete saturation to the light source's color at the
brightest area (center) of the highlight. The default phong 0.0
gives no highlight.
The size of the highlight spot is defined by the phong_size
value. The larger the phong size the
tighter, or smaller, the highlight and the shinier the appearance. The smaller the phong size the looser, or larger,
the highlight and the less glossy the appearance.
Typical values range from 1.0 (very dull) to 250 (highly polished) though any values may be used. Default phong
size is 40 (plastic) if phong_size
is not specified. For example:
finish { phong 0.9 phong_size 60 }
If phong
is not specified phong_size
has no effect.
The specular
keyword in a finish
statement produces a highlight which is very similar to
Phong highlighting but it uses slightly different model. The specular model more closely resembles real specular
reflection and provides a more credible spreading of the highlights occurring near the object horizons.
The specular value is typically from 0.0 to 1.0, where 1.0 causes complete saturation to the light source's color
at the brightest area (center) of the highlight. The default specular 0.0
gives no highlight.
The size of the spot is defined by the value given the
roughness
keyword. Typical values range from 1.0 (very rough - large highlight) to 0.0005 (very smooth - small
highlight). The default value, if roughness is not specified, is 0.05 (plastic).
It is possible to specify wrong values for roughness that will generate an error when you try to render the file. Do not use 0 and if you get errors check to see if you are using a very, very small roughness value that may be causing the error. For example:
finish { specular 0.9 roughness 0.02 }
If specular
is not specified roughness
has no effect.
Note: that when light is reflected by a surface such as a mirror, it is called specular
reflection however such reflection is not controlled by the specular
keyword. The reflection
keyword controls mirror-like specular reflection.
The keyword metallic
may be used with phong
or specular
highlights. This
keyword indicates that the color of the highlights will be calculated by an empirical function that models the
reflectivity of metallic surfaces.
Normally highlights are the color of the light source. Adding this keyword filters the highlight so that white light reflected from a metallic surface takes the color specified by the pigment
The metallic
keyword may optionally be follow by a numeric value to specify the influence the amount
of the effect. If no keyword is specified, the default value is zero. If the keyword is specified without a value, the
default value is one. For example:
finish { phong 0.9 phong_size 60 metallic }
If phong
or specular
keywords are not specified then metallic
has no effect.
When light does not diffuse and it does reflect at the same angle as it hits an object, it is called specular
reflection. Such mirror-like reflection is controlled by the reflection {...}
block in a finish
statement.
Syntax:
finish { reflection { [COLOR_REFLECTION_MIN,] COLOR_REFLECTION_MAX [fresnel BOOL_ON_OFF] [falloff FLOAT_FALLOFF] [exponent FLOAT_EXPONENT] [metallic FLOAT_METALLIC] } } [interior { ior IOR }]
The simplest use would be a perfect mirror:
finish { reflection {1.0} ambient 0 diffuse 0 }
This gives the object a mirrored finish. It will reflect all other elements in the scene. Usually a single float value is specified after the keyword even though the syntax calls for a color. For example a float value of 0.3 gets promoted to the full color vector <0.3,0.3,0.3,0.3,0.3> which is acceptable because only the red, green and blue parts are used.
The value can range from 0.0 to 1.0. By default there is no reflection.
Note:
finish
{ reflection rgb <1,0,0> }
specular
keyword. That
keyword controls a specular highlight.
reflection COLOR
" and "reflection_exponent
Float" without braces is still supported for backward compatibility.
falloff
sets a falloff exponent in the variable reflection. This is the exponent telling how fast the
reflectivity will fall off, i.e. linear, squared, cubed, etc.
The metallic
keyword is similar in function to the "metallic" keyword used for highlights in
finishes: it simulates the reflective properties of metallic surfaces, where reflected light takes on the colour of
the surface. When metallic
is used, the "reflection" color is multiplied by the pigment color
at each point. You can specify an optional float value, which is the amount of influence the metallic
keyword has on the reflected color. metallic
uses the Fresnel equation so that the color of the light is
reflected at glancing angles, and the color of the metal is reflected for angles close to the surface's normal.
exponent
POV-Ray uses a limited light model that cannot distinguish between objects which are
simply brightly colored and objects which are extremely bright. A white piece of paper, a light bulb, the sun, and a
supernova, all would be modeled as rgb<1,1,1>
and slightly off-white objects would be only slightly
darker. It is especially difficult to model partially reflective surfaces in a realistic way. Middle and lower
brightness objects typically look too bright when reflected. If you reduce the reflection
value, it tends
to darken the bright objects too much. Therefore the optional exponent
keyword has been added. It
produces non-linear reflection intensities. The default value of 1.0 produces a linear curve. Lower values darken
middle and low intensities and keeps high intensity reflections bright. This is a somewhat experimental feature
designed for artistic use. It does not directly correspond to any real world reflective properties.
Variable reflection
Many
materials, such as water, ceramic glaze, and linoleum are more reflective when viewed at shallow angles. This can be
simulated by also specifying a minimum reflection in the reflection {...}
statement.
For example:
finish { reflection { 0.03, 1 }}
uses the same function as the standard reflection, but the first parameter sets the minimum reflectivity. It could
be a color vector or a float (which is automatically promoted to a gray vector). This minimum value is how reflective
the surface will be when viewed from a direction parallel to its normal.
The second parameter sets the maximum
reflectivity, which could also be a color vector or a float (which is automatically promoted to a gray vector). This
maximum parameter is how reflective the surface will be when viewed at a 90-degree angle to its normal.
Note: You can make maximum reflection less than minimum reflection if you want, although the result is something that does not occur in nature.
When adding the fresnel
keyword, the Fresnel reflectivity function is used instead of standard
reflection. It calculates reflectivity using the finish's IOR. So with a fresnel reflection_type an interior {
ior IOR }
statement is required, even with opaque pigments. Remember that in real life many opaque objects have
a thin layer of transparent glaze on their surface, and it is the glaze (which -does- have an IOR) that is reflective.
One of the features in POV-Ray is variable reflection, including realistic Fresnel reflection (see section "Variable Reflection "). Unfortunately, when this is coupled with constant transmittance, the texture can look unrealistic. This unrealism is caused by the scene breaking the law of conservation of energy. As the amount of light reflected changes, the amount of light transmitted should also change (in a give-and-take relationship).
This can be achieved by adding the conserve_energy
keyword to the object's finish {}
.
When
conserve_energy is enabled, POV-Ray will multiply the amount filtered and transmitted by what is left over from
reflection (for example, if reflection is 80%, filter/transmit will be multiplied by 20%).
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. This effect is controlled by the irid
statement specified inside a finish
statement.
This parameter 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 syntax is:
IRID: irid { Irid_Amount [IRID_ITEMS...] } IRID_ITEMS: thickness Amount | turbulence Amount
The required Irid_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 default value is zero.
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. This parameter varies only a single
value: the thickness. Therefore the value must be a single float value. It cannot be a vector as in other uses of the turbulence
keyword.
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. See also the global setting "Irid_Wavelength".
The concept used for this feature came from the book Fundamentals of Three-Dimensional Computer Graphics by Alan Watt (Addison-Wesley).
3.5.2 Normal | 3.5.3 Finish | 3.5.4 Halo |