Difference between revisions of "Reference:Finish"
Jholsenback (talk | contribs) m (link repair) |
Jholsenback (talk | contribs) m (1 revision: Reference Migration Initial Load) |
(No difference)
|
Revision as of 19:06, 15 March 2012
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 [albedo] Amount [, Amount] | emission COLOR | brilliance Amount | phong [albedo] Amount | phong_size Amount | specular [albedo] Amount | roughness Amount | metallic [Amount] | reflection COLOR | crand Amount | conserve_energy BOOL_ON_OFF | reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] } | subsurface { translucency COLOR } | 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 more 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.
Ambient
The light you see in dark shadowed areas comes from diffuse reflection off of other objects. This light cannot be modeled directly using ray-tracing, however, the radiosity feature can do a realistic approximation at the cost of higher render times. For most scenes, especially in-door scenes, this is will greatly improve the end result.
The classic way to simulate ambient lighting in shadowed areas is to assume that light is scattered everywhere in the room equally, so the effect can simply be calculated by adding a small amount of light to each texture, whether or not a light is actually shining on that texture. This renders very fast, but has the disadvantage that shadowed areas look flat.
Note: Without radiosity, ambient light 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.
The ambient
keyword controls the amount of ambient light used for each object. In some situations the ambient light might also be tinted, for this a color value can be specified. For example:
finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient
However, if all color components are equal, a single float value may be used. For example the single float value of 0.3 is treated as <0.3,0.3,0.3>. The default value is 0.1, which gives very little ambient light. As with light sources, physically meaningful values are greater than 0, but negative values actually work too, and the value may be arbitrarily high to simulate bright light.
You may also specify the overall ambient light level used when calculating the ambient lighting of an object using the global ambient_light
setting. The total light is given by Ambient = Finish_Ambient * Global_Ambient_Light_Source. See the section Ambient Light for more details.
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. Specifying a high ambient
value for an object effectively gives it an intrinsic glow, however, if the intent is to actually have it glowing (as opposed to simulating background light), the emission
keyword should be used instead. The difference is that actual glowing objects light up their surroundings in radiosity scenes, while the ambient
term is effectively set to zero.
Note: Specular reflected indirect illumination such as the flashlight shining in a mirror is not modeled by either ambient light or radiosity. For this, you need photons.
Emission
As of version 3.7, you can now add the emission
keyword to the finish block. The intention is to simplify the use of materials designed for non-radiosity scenes in scenes with radiosity, or the design of scenes that can be rendered with or without radiosity.
The syntax and effect are virtually identical to ambient
, except that emission is unaffected by the global ambient_light
parameter. An objects ambient
term is now effectively set to 0 if radiosity is active, the exception being, in legacy scenes where the #version
is set to less than 3.7
Diffuse Reflection Items
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.
Diffuse
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. The optional keyword albedo
can be used right after diffuse to specify that the parameter is to be taken as the total diffuse/specular reflectance, rather than peak reflectance.
Note: When brilliance
is equal to 1 albedo
will have no effect on the diffuse parameter.
For example:
finish { diffuse albedo 0.7 }
Means that 70% of the light seen comes from direct illumination from light sources. The default value for diffuse is 0.6.
To model thin, diffusely-translucent objects (e.g. paper, curtains, leaves etc.), an optional 2nd float parameter has been added to the diffuse
finish statement to control the effect of illumination from the back of the surface. The default value is 0.0, i.e. no diffuse backside illumination. For realistic results, the sum of both parameters should be between 0.0 and 1.0, and the 2nd parameter should be the smaller of the two.
Note: This feature is currently experimental and may be subject to change. In particular, the syntax as well as inter-operation with double_illuminate
, multi-layered textures or conserve_energy
are still under investigation.
A new sample scene, ~scenes/advanced/diffuse_back.pov
, has been provided to illustrate this new feature.
Brilliance
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.
Crand Graininess
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: The crand
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.
Subsurface Light Transport
The subsurface light transport feature, also know as subsurface scattering, is enabled ONLY when a global_settings
subsurface block is present. For example, to enable SSLT and use it's default settings, you can specify an empty block.
global_settings { subsurface {} }
To activate SSLT for a particular object you will also need to add the following statement to its finish block.
material { texture { pigment { PIGMENT } finish { ... subsurface { translucency COLOR } } } interior { ior FLOAT } }
The pigment determines the SSLT material's overall appearance when applied to an object with sufficiently large structures. The translucency
color, which can alternatively be a float, determines the strength of the subsurface light transport effect. The material's index of refraction also affects the appearance, and is essential for SSLT materials, but doesn't generate a warning at parse time if omitted.
Note: The effect doesn't scale with the object, and values may be greater than 1.0
To adjust materials to the dimensions of your scene, you should use the mm_per_unit
setting in the global settings block. The algorithm is designed to give realistic results at a scale of 10 mm per POV-Ray unit by default. For other scales, you can place the following statement in the global_settings
block:
mm_per_unit INT
Hint: Using these scaling examples as a guide you can easily come up with a suitable setting.
- 1 cm per unit, set it to 10 (the default)
- 1 inch per unit, set it to 25.4
- 1 m per unit, set it to 1000
To tune the algorithm for quality or performance, the number of samples for the diffuse scattering and single-scattering approximation, respectively, can be specified by placing the following statement in the global_settings
section. Both values default is 50.
subsurface { samples INT, INT }
See the sample SSLT scene in ~scenes/subsurface/subsurface.pov
for more information. See also this PDF document, A Practical Model for Subsurface Light Transport, for more in depth information about SSLT, including some sample values to use when defining new materials.
To specify whether subsurface light transport effects should be applied to incoming radiosity
based diffuse illumination, you should place the following in the global settings subsurface
block:
global_settings { subsurface { radiosity BOOL } }
If this setting is off
, the default, subsurface light transport effects will only be applied to direct illumination from classic light sources. Setting this feature to on
will improve realism especially for materials with high translucency, but at a significant cost in rendering time.
See the section Subsurface and Radiosity for additional configuration information.
Note: Subsurface scattering is disabled in all quality levels except +Q9
or higher.
Warning: Be advised that the subsurface scattering feature is still experimental. These conditions, and possibly others, can apply. Usage and syntax is also subject to change!
- Incorrect use may result in hard crashes instead of parse warnings.
- Pigments having any zero color components currently doesn't play nice with SSLT. For example use
rgb <1,0.01,0.01>
instead ofrgb <1,0,0>
as color literals or when declaring pigment identifiers. - A diffuse finish attribute of zero can also cause povray to throw an assertion failure.
- Unions of overlapping objects will probably give unexpected results, however merge should work.
- Mesh objects need to be closed (not perfectly) for realism.
Highlights
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.
Phong Highlights
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 value is 0.0 and 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. The default value is 40 (plastic) if phong_size
is not specified.
The optional keyword albedo
can be used right after phong to specify that the parameter is to be taken as the total diffuse/specular reflectance, rather than peak reflectance.
For example:
finish { phong albedo 0.9 phong_size 60 }
If phong
is not specified phong_size
has no effect.
Specular Highlight
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 value is 0.0 and 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. Do not use 0! If you get errors, check to see if you are using a very, very small roughness value that may be causing the error.
The optional keyword albedo
can be used right after specular to specify that the parameter is to be taken as the total diffuse/specular reflectance, rather than peak reflectance.
For example:
finish { specular albedo 0.9 roughness 0.02 }
If specular
is not specified roughness
has no effect.
Note: 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.
Metallic Highlight Modifier
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 1.
For example:
finish { phong 0.9 phong_size 60 metallic }
If phong
or specular
keywords are not specified then metallic
has no effect.
Specular Reflection
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: You should be aware that:
- Adding reflection to a texture makes it take longer to render because additional rays must be traced.
-
The reflected light may be tinted by specifying a color rather than a float. For example,
finish { reflection rgb <1,0,0> }
gives a red mirror that only reflects red light. -
Although such reflection is called specular it is not controlled by the
specular
keyword. That keyword controls a specular highlight. -
The old syntax for simple reflection:
reflection COLOR
andreflection_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.
Conserve Energy for Reflection
One of the features in POV-Ray is variable reflection, including realistic Fresnel reflection (see the section on Variable Reflection). Unfortunately, when this is coupled with constant transmittance, the texture can look unrealistic. This unreal-ism 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
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 for additional information.
Note: The version 3.7 iridescence feature has had a major overhaul. The syntax remains the same, however, both the thickness and amount values are now specified in microns. Consequently, iridescence effects will vary from previous versions.
The concept used for this feature came from the book Fundamentals of Three-Dimensional Computer Graphics by Alan Watt (Addison-Wesley).