Difference between revisions of "Reference:Finish"
Jholsenback (talk | contribs) m (cleanup round 2) |
m (Precision about 40 char limited version number) |
||
(28 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Textures]] | [[Category:Textures]] | ||
[[Category:Object Modifiers]] | [[Category:Object Modifiers]] | ||
+ | __NOTOC__ | ||
{{#indexentry:finish, keyword}} | {{#indexentry:finish, keyword}} | ||
{{#indexentry:keyword, finish}} | {{#indexentry:keyword, finish}} | ||
− | <p> | + | <p>How does light reflect, what happens in shadows and what kind of highlights are visible? The <code>finish</code> properties of a surface can greatly affect its appearance.</p> |
+ | |||
<p>The syntax for <code>finish</code> is as follows:</p> | <p>The syntax for <code>finish</code> is as follows:</p> | ||
+ | |||
<pre> | <pre> | ||
FINISH: | FINISH: | ||
finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] } | finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] } | ||
FINISH_ITEMS: | FINISH_ITEMS: | ||
− | ambient COLOR | diffuse [albedo] Amount [, Amount] | emission COLOR | | + | fresnel FLOAT |
− | + | ambient COLOR | diffuse [albedo] Amount [, Amount] | | |
− | + | emission COLOR | brilliance Amount | phong [albedo] Amount | phong_size Amount | | |
− | crand Amount | conserve_energy | + | specular [albedo] Amount | roughness Amount | |
+ | metallic [Amount] | reflection COLOR | | ||
+ | crand Amount | conserve_energy BOOL | | ||
reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] } | | reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] } | | ||
subsurface { translucency COLOR } | | subsurface { translucency COLOR } | | ||
− | irid { Irid_Amount [IRID_ITEMS...] } | + | irid { Irid_Amount [IRID_ITEMS...] | |
+ | use_alpha BOOL | ||
+ | } | ||
REFLECTION_ITEMS: | REFLECTION_ITEMS: | ||
− | COLOR_REFLECTION_MAX | fresnel | + | COLOR_REFLECTION_MAX | fresnel BOOL | |
falloff FLOAT_FALLOFF | exponent FLOAT_EXPONENT | | falloff FLOAT_FALLOFF | exponent FLOAT_EXPONENT | | ||
metallic FLOAT_METALLIC | metallic FLOAT_METALLIC | ||
Line 23: | Line 30: | ||
thickness Amount | turbulence Amount | thickness Amount | turbulence Amount | ||
</pre> | </pre> | ||
+ | |||
+ | <p class="Note"><strong>Note:</strong> In versions prior to 3.6.2, identifier names <em>were</em> limited to 40 characters. There has been a {{Change}} removing that restriction.</p> | ||
<p>The <em>FINISH_IDENTIFIER</em> is optional but should proceed all other items. Any items after the <em>FINISH_IDENTIFIER</em> modify or override settings given in the <em>FINISH_IDENTIFIER</em>. If no identifier is specified then the items modify the finish values in the current default texture.</p> | <p>The <em>FINISH_IDENTIFIER</em> is optional but should proceed all other items. Any items after the <em>FINISH_IDENTIFIER</em> modify or override settings given in the <em>FINISH_IDENTIFIER</em>. If no identifier is specified then the items modify the finish values in the current default texture.</p> | ||
+ | |||
<p class="Note"><strong>Note:</strong> Transformations are not allowed inside a finish because finish items cover the entire surface uniformly. Each of the <em>FINISH_ITEMS</em> listed above is described in sub-sections below.</p> | <p class="Note"><strong>Note:</strong> Transformations are not allowed inside a finish because finish items cover the entire surface uniformly. Each of the <em>FINISH_ITEMS</em> listed above is described in sub-sections below.</p> | ||
− | <p>In earlier versions of POV-Ray, the <code>refraction</code>, <code>ior</code>, and <code>caustics</code> keywords were part of the <code>finish</code> statement but they are now part of the <code>interior</code> statement. They are still supported under <code>finish</code> for backward compatibility but the results may not be 100% identical to previous versions. See | + | |
− | <p>A <code>finish</code> statement is part of a <code>texture</code> specification. However it can be tedious to use a <code>texture</code> 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 | + | <p>In earlier versions of POV-Ray, the <code>refraction</code>, <code>ior</code>, and <code>caustics</code> keywords were part of the <code>finish</code> statement but they are now part of the <code>interior</code> statement. They are still supported under <code>finish</code> for backward compatibility but the results may not be 100% identical to previous versions. See [[Reference:Interior#Why are Interior and Media Necessary?|Why are Interior and Media Necessary?]] for more details.</p> |
+ | |||
+ | <p>A <code>finish</code> statement is part of a <code>texture</code> specification. However it can be tedious to use a <code>texture</code> 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 it as part of a texture. For example instead of this:</p> | ||
+ | |||
<pre> | <pre> | ||
object { My_Object texture { finish { phong 0.5 } } } | object { My_Object texture { finish { phong 0.5 } } } | ||
Line 44: | Line 57: | ||
#local IDENTIFIER = FINISH | #local IDENTIFIER = FINISH | ||
</pre> | </pre> | ||
− | <p>Where <em>IDENTIFIER</em> is the name of the identifier | + | <p>Where <em>IDENTIFIER</em> is the name of the identifier and <em>FINISH</em> is any valid <code>finish</code> statement. See [[Reference:Declare and Local Directives#declare vs. local|#declare vs. #local]] for information on identifier scope.</p> |
+ | |||
+ | <p class="Note"><strong>Note:</strong> For more physical realism a {{Change}} in version 3.8 expands <code>fresnel</code> angle-dependent attenuation use to now include the <code>ambient</code>, <code>diffuse</code>, <code>emission</code>, <code>specular</code> and <code>phong</code> components. The details are as follows:</p> | ||
+ | <p>When used directly in the <code>finish</code> block the <code>fresnel</code> keyword activates <em>Fresnel</em> effects for all of the <code>ambient</code>, <code>diffuse</code>, <code>emission</code>, <code>specular</code> and <code>phong</code> attributes. At steep viewing and/or light source angles it decreases the brightness of the <code>specular</code> and <code>phong</code> components. At shallow viewing angles and/or light source angles it instead decreases the brightness of the <code>ambient</code>, <code>diffuse</code> and <code>emission</code> components. The <code>fresnel</code> parameter can also be set to an intermediate value, in order to allow for the approximate modelling of anti-reflective coatings.</p> | ||
+ | |||
+ | <p>In the following example the <code>diffuse</code>, <code>phong</code> and <code>specular</code> syntax, which is normally used to specify the effective <em>bi-hemispheric albedo</em> of that respective component, does not work as advertised when finish-level <code>fresnel</code> is set to non-zero. Instead, <code>diffuse</code> will specify the <em>albedo</em> that the object would exhibit if it had a refractive index of 1, while <code>phong</code> and <code>specular</code> will specify the <em>albedo</em> that the object would exhibit if it had an infinitely large refractive index. As a result, while you would normally want to choose parameters such that <em>D_Value + P_Value + S_Value <= 1</em>. With finish-level <code>fresnel</code> set to a non-zero value you would want to choose parameters such that <em>D_Value <= 1</em> and <em>P_Value + S_Value <= 1</em>. For optimal realism, you should specify the settings as noted below, and control the brightness of the <code>diffuse</code> component via the layer pigment.</p> | ||
+ | |||
+ | <pre> | ||
+ | // general values | ||
+ | finish { | ||
+ | diffuse albedo D_Value | ||
+ | phong albedo P_Value | ||
+ | specular albedo S_Value | ||
+ | } | ||
+ | |||
+ | // optimal realism | ||
+ | finish { | ||
+ | diffuse albedo 1 | ||
+ | phong albedo 0 | ||
+ | specular albedo 1 | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | <p>Setting finish-level <code>fresnel</code> will automatically activate (if set to a non-zero value) or deactivate (if set to zero) the reflection-level <code>fresnel</code> parameter. This can be overridden by specifying the reflection parameters <em>after</em> the finish-level <code>fresnel</code> parameter. For optimal realism, the maximum reflection should be set equal to the finish-level <code>fresnel</code> parameter, while the minimum reflection should be set to zero.</p> | ||
+ | |||
+ | <p>When subsurface light transport is enabled, the finish-level <code>fresnel</code> parameter will have no effect on the <code>diffuse</code> attribute; instead, the feature will always act as if the parameter had been set to 1.</p> | ||
+ | |||
+ | <p>Radiosity-based illumination currently does not account for the <em>Fresnel</em> effect on incoming light, regardless of the finish-level <code>fresnel</code> parameter.</p> | ||
+ | |||
+ | <p>{{New}} in version 3.8 you can now specify <code>use_alpha</code> in the <code>finish</code> block. If set to <code>off</code>, the default and also the old behavior, then <code>pigment</code> <em>filter</em> and <em>transmit</em> only hide the surface's <code>diffuse</code>, <code>ambient</code> and <code>emission</code> components. If set to <code>on</code> then <code>pigment</code> <em>filter</em> and <em>transmit</em> also hide the surface's highlights and <code>specular</code> reflection.</p> | ||
+ | |||
+ | ==Ambient== | ||
{{#indexentry:ambient, finish}} | {{#indexentry:ambient, finish}} | ||
{{#indexentry:keyword, ambient}} | {{#indexentry:keyword, ambient}} | ||
− | + | <p>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 [[Documentation:Tutorial Section 3.7#Radiosity|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.</p> | |
− | <p>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 [[Documentation:Tutorial Section 3.7#Radiosity | ||
− | <p>The classic way to simulate <em> | + | <p>The classic way to simulate <em>Ambient Lighting</em> in shadowed areas is to assume that light is scattered |
− | everywhere in the room equally | + | everywhere in the room equally. 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 | whether or not a light is actually shining on that texture. This renders very fast, but has the disadvantage that shadowed | ||
areas look flat.</p> | areas look flat.</p> | ||
− | <p class="Note"><strong>Note:</strong> Without radiosity | + | <p class="Note"><strong>Note:</strong> Without radiosity ambient light does not account for the color of surrounding objects. For instance, when entering a room where the walls, floor and ceiling are red, your white clothing will look pink from the reflected light. POV-Ray's ambient shortcut does <em>not</em> account for this.</p> |
− | <p>The <code>ambient</code> keyword controls the amount of ambient light used for each object. In some situations the ambient light <em>might</em> also be tinted | + | <p>The <code>ambient</code> keyword controls the amount of ambient light used for each object. In some situations the ambient light <em>might</em> also be tinted. In that case a color value can be specified as in the example below:</p> |
<pre> | <pre> | ||
finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient | finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient | ||
</pre> | </pre> | ||
− | + | <p>If all color components are equal, a single float value may be used. In other words a 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 typically greater than 0, but negative values work too. Lastly the value can also be arbitrarily high to simulate a very bright light.</p> | |
+ | |||
+ | <p>You may also specify the overall ambient light level used when calculating the ambient lighting of an object using the global <code>ambient_light</code> setting.</p> | ||
− | <p> | + | <p>The total light defined as: <strong><em>Ambient = Finish_Ambient * Global_Ambient_Light_Source</em></strong>. See also: [[Reference:Global Settings#Ambient_Light|Ambient Light]] for more details.</p> |
− | <p>Ambient light affects both shadowed and non-shadowed areas, so if you turn up the <code>ambient</code> value, you may want to turn down the <code>diffuse</code> and <code>reflection</code> values | + | <p>Ambient light affects both shadowed and non-shadowed areas, so if you turn up the <code>ambient</code> value, you may want to turn down the <code>diffuse</code> and <code>reflection</code> values.</p> |
− | <p | + | <p>There has been a {{Change}} as of version 3.7 in that the <em>ambient</em> mechanism is now automatically turned off when <code>radiosity</code> is enabled, provided that <code>#version</code> is set to 3.7 or higher. This will allow use of the same material definitions in both <em>radiosity and non-radiosity</em> scenes. As a consequence, the practice of co-opting <code>ambient</code> to model glowing materials will no longer work in <code>radiosity</code> scenes and is therefore strongly discouraged altogether; instead, the new <code>emission</code> keyword has been added specifically for this purpose.</p> |
+ | <p class="Note"><strong>Note:</strong> Specular reflected indirect illumination like a flashlight shining in a mirror cannot modeled by either ambient light or radiosity. Use [[Reference:Photons|photons]] instead.</p> | ||
+ | |||
+ | <p>In version 3.8 there has been a {{Change}} to the <code>ambient</code> default setting. The default setting is now <code>ambient 0</code> as opposed to the <code>ambient 0.1</code> value used in previous versions. Requires <code>#version 3.8;</code> or equivalent INI setting or command-line option. See also: [[Reference:Version Directive|Version Directive]].</p> | ||
+ | |||
+ | ==Emission== | ||
{{#indexentry:emission, finish}} | {{#indexentry:emission, finish}} | ||
{{#indexentry:keyword, emission}} | {{#indexentry:keyword, emission}} | ||
− | + | <p>The <code>emission</code> keyword {{New}} in version 3.7 can be used to model glowing materials, eliminating the need to co-opt <code>ambient</code> for this purpose. | |
− | <p> | + | </p> |
− | <p>The syntax and effect are virtually identical to <code> | + | <p>The syntax and effect are virtually identical to <code>ambient</code>, <em>except</em> that <code>emission</code> is unaffected by the global <code>ambient_light</code> parameter, and is <em>not</em> turned off when using radiosity.</p> |
+ | <p>See also: [[Reference:Finish#Ambient|Ambient]]</p> | ||
==Diffuse Reflection Items== | ==Diffuse Reflection Items== | ||
Line 81: | Line 132: | ||
or spreads in a variety of directions. It accounts for the majority of the reflected light we see.</p> | or spreads in a variety of directions. It accounts for the majority of the reflected light we see.</p> | ||
+ | ===Diffuse=== | ||
{{#indexentry:diffuse, finish}} | {{#indexentry:diffuse, finish}} | ||
{{#indexentry:keyword, diffuse}} | {{#indexentry:keyword, diffuse}} | ||
{{#indexentry:albedo, finish}} | {{#indexentry:albedo, finish}} | ||
{{#indexentry:keyword, albedo}} | {{#indexentry:keyword, albedo}} | ||
− | |||
<p>The keyword <code>diffuse</code> is used in a <code>finish</code> statement to control how much of the light coming directly from any light sources is reflected via diffuse reflection. The optional keyword <code>albedo</code> 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.</p> | <p>The keyword <code>diffuse</code> is used in a <code>finish</code> statement to control how much of the light coming directly from any light sources is reflected via diffuse reflection. The optional keyword <code>albedo</code> 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.</p> | ||
+ | |||
<p class="Note"><strong>Note:</strong> When <code>brilliance</code> is equal to 1 <code>albedo</code> will have no effect on the diffuse parameter.</p> | <p class="Note"><strong>Note:</strong> When <code>brilliance</code> is equal to 1 <code>albedo</code> will have no effect on the diffuse parameter.</p> | ||
+ | |||
<p>For example:</p> | <p>For example:</p> | ||
<pre> | <pre> | ||
− | finish { diffuse albedo 0.7 } | + | finish { diffuse albedo 0.7 fresnel } |
</pre> | </pre> | ||
+ | |||
<p>Means that 70% of the light seen comes from direct illumination from light sources. The default value for diffuse is 0.6.</p> | <p>Means that 70% of the light seen comes from direct illumination from light sources. The default value for diffuse is 0.6.</p> | ||
+ | |||
<p>To model thin, diffusely-translucent objects (e.g. paper, curtains, leaves etc.), an optional 2nd float parameter has been added to the <code>diffuse</code> 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.</p> | <p>To model thin, diffusely-translucent objects (e.g. paper, curtains, leaves etc.), an optional 2nd float parameter has been added to the <code>diffuse</code> 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.</p> | ||
+ | |||
<p class="Note"><strong>Note:</strong> This feature is currently experimental and may be subject to change. In particular, the syntax as well as inter-operation with <code>double_illuminate</code>, multi-layered textures or <code>conserve_energy</code> are still under investigation.</p> | <p class="Note"><strong>Note:</strong> This feature is currently experimental and may be subject to change. In particular, the syntax as well as inter-operation with <code>double_illuminate</code>, multi-layered textures or <code>conserve_energy</code> are still under investigation.</p> | ||
+ | |||
<p>A new sample scene, <code>~scenes/advanced/diffuse_back.pov</code>, has been provided to illustrate this new feature.</p> | <p>A new sample scene, <code>~scenes/advanced/diffuse_back.pov</code>, has been provided to illustrate this new feature.</p> | ||
+ | ===Brilliance=== | ||
{{#indexentry:brilliance, finish}} | {{#indexentry:brilliance, finish}} | ||
{{#indexentry:keyword, brilliance}} | {{#indexentry:keyword, brilliance}} | ||
− | |||
<p>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 <code>brilliance</code> keyword can be used in a <code>finish</code> 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.</p> | <p>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 <code>brilliance</code> keyword can be used in a <code>finish</code> 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.</p> | ||
+ | ===Crand Graininess=== | ||
{{#indexentry:crand, finish}} | {{#indexentry:crand, finish}} | ||
{{#indexentry:keyword, crand}} | {{#indexentry:keyword, crand}} | ||
− | |||
<p>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 <code>crand</code> keyword can be added to a <code>finish</code> to cause a minor random darkening in the diffuse reflection of direct illumination. Typical values range from <code>crand 0.01</code> to <code>crand 0.5</code> or higher. The default value is 0. For example:</p> | <p>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 <code>crand</code> keyword can be added to a <code>finish</code> to cause a minor random darkening in the diffuse reflection of direct illumination. Typical values range from <code>crand 0.01</code> to <code>crand 0.5</code> or higher. The default value is 0. For example:</p> | ||
+ | |||
<pre> | <pre> | ||
finish { crand 0.05 } | finish { crand 0.05 } | ||
Line 112: | Line 170: | ||
<p class="Note"><strong>Note:</strong> The <code>crand</code> 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 <code>crand</code> value. For these reasons it is not a very accurate way to model the rough surface effect.</p> | <p class="Note"><strong>Note:</strong> The <code>crand</code> 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 <code>crand</code> value. For these reasons it is not a very accurate way to model the rough surface effect.</p> | ||
+ | ===Subsurface Light Transport=== | ||
{{#indexentry:keyword, subsurface}} | {{#indexentry:keyword, subsurface}} | ||
− | {{#indexentry: | + | {{#indexentry:subsurface light transport}} |
{{#indexentry:SSLT}} | {{#indexentry:SSLT}} | ||
{{#indexentry:keyword, translucency}} | {{#indexentry:keyword, translucency}} | ||
− | |||
− | |||
<p>The subsurface light transport feature, also know as subsurface scattering, is enabled <em>ONLY</em> when a <code>global_settings</code> subsurface block is present. For example, to enable SSLT and use it's default settings, you can specify an empty block.</p> | <p>The subsurface light transport feature, also know as subsurface scattering, is enabled <em>ONLY</em> when a <code>global_settings</code> subsurface block is present. For example, to enable SSLT and use it's default settings, you can specify an empty block.</p> | ||
<pre> | <pre> | ||
Line 139: | Line 196: | ||
<p>The pigment determines the SSLT material's overall appearance when applied to an object with sufficiently large structures. The <code>translucency</code> 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 <em>essential</em> for SSLT materials, but doesn't generate a warning at parse time if omitted.</p> | <p>The pigment determines the SSLT material's overall appearance when applied to an object with sufficiently large structures. The <code>translucency</code> 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 <em>essential</em> for SSLT materials, but doesn't generate a warning at parse time if omitted.</p> | ||
<p class="Note"><strong>Note:</strong> The effect doesn't scale with the object, and values may be greater than 1.0</p> | <p class="Note"><strong>Note:</strong> The effect doesn't scale with the object, and values may be greater than 1.0</p> | ||
− | <p>To adjust materials to the dimensions of your scene, you should | + | <p>To adjust materials to the dimensions of your scene, you <em>should</em> first determine the proper <code>mm_per_unit</code> setting (it should always match the actual scale of the object) to use in the global settings block, <em>then</em> adjust the materials <code>translucency</code> value.</p> |
+ | <p class="Note"><strong>Note:</strong> Any effect that can be achieved by changing <code>mm_per_unit</code> can also be achieved by adjusting the <code>translucency</code> value of materials.</p> | ||
+ | <p>The <code>mm_per_unit</code> 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 <code>global_settings</code> block:</p> | ||
<pre> | <pre> | ||
mm_per_unit INT | mm_per_unit INT | ||
Line 182: | Line 241: | ||
<p class="Note"><strong>Note:</strong> Specular and phong highlights are <em>not</em> mutually exclusive. It is possible to specify both and they will both take effect. Normally, however, you will only specify one or the other.</p> | <p class="Note"><strong>Note:</strong> Specular and phong highlights are <em>not</em> mutually exclusive. It is possible to specify both and they will both take effect. Normally, however, you will only specify one or the other.</p> | ||
+ | ===Phong Highlights=== | ||
{{#indexentry:phong, finish}} | {{#indexentry:phong, finish}} | ||
{{#indexentry:keyword, phong}} | {{#indexentry:keyword, phong}} | ||
{{#indexentry:phong_size, finish}} | {{#indexentry:phong_size, finish}} | ||
{{#indexentry:keyword, phong_size}} | {{#indexentry:keyword, phong_size}} | ||
− | + | <p>The <code>phong</code> keyword in the <code>finish</code> 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 <em>phong</em> method measures the average of the facets facing in the mirror direction from the light sources to the viewer.</p> | |
− | <p>The <code>phong</code> keyword in the <code>finish</code> 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. | + | |
− | + | <p>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 <code>phong_size</code> 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 <code>phong_size</code> is not specified.</p> | |
− | <p>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. | + | |
− | + | <p>The optional keyword <code>albedo</code> can be used right after <code>phong</code> to specify that the parameter is to be taken as the total diffuse/specular reflectance, rather than peak reflectance.</p> | |
− | + | ||
− | <p>The optional keyword <code>albedo</code> 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.</p> | ||
<p>For example:</p> | <p>For example:</p> | ||
<pre> | <pre> | ||
− | finish { phong albedo 0.9 phong_size 60 } | + | finish { phong albedo 0.9 phong_size 60 fresnel } |
</pre> | </pre> | ||
<p>If <code>phong</code> is not specified <code>phong_size</code> has no effect.</p> | <p>If <code>phong</code> is not specified <code>phong_size</code> has no effect.</p> | ||
+ | ===Specular Highlight=== | ||
{{#indexentry:specular, finish}} | {{#indexentry:specular, finish}} | ||
{{#indexentry:keyword, specular}} | {{#indexentry:keyword, specular}} | ||
+ | {{#indexentry:roughness, finish}} | ||
+ | {{#indexentry:keyword, roughness}} | ||
+ | <p>The <code>specular</code> keyword in a <code>finish</code> 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.</p> | ||
− | + | <p>The <code>specular</code> 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 <code>roughness</code> 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).</p> | |
− | |||
− | <p>The <code>specular</code> 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.</p> | ||
− | |||
− | |||
− | |||
<p>It is possible to specify wrong values for <code>roughness</code> 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.</p> | <p>It is possible to specify wrong values for <code>roughness</code> 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.</p> | ||
+ | |||
<p>The optional keyword <code>albedo</code> 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.</p> | <p>The optional keyword <code>albedo</code> 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.</p> | ||
+ | |||
<p>For example:</p> | <p>For example:</p> | ||
<pre> | <pre> | ||
− | finish { specular albedo 0.9 roughness 0.02 } | + | finish { specular albedo 0.9 roughness 0.02 fresnel } |
</pre> | </pre> | ||
<p>If <code>specular</code> is not specified <code>roughness</code> has no effect.</p> | <p>If <code>specular</code> is not specified <code>roughness</code> has no effect.</p> | ||
+ | |||
<p class="Note"><strong>Note:</strong> When light is reflected by a surface such as a mirror, it is called <em>specular reflection</em> however such reflection is not controlled by the <code>specular</code> keyword. The <code>reflection</code> keyword controls mirror-like specular reflection.</p> | <p class="Note"><strong>Note:</strong> When light is reflected by a surface such as a mirror, it is called <em>specular reflection</em> however such reflection is not controlled by the <code>specular</code> keyword. The <code>reflection</code> keyword controls mirror-like specular reflection.</p> | ||
+ | ===Metallic Highlight Modifier=== | ||
{{#indexentry:metallic, finish}} | {{#indexentry:metallic, finish}} | ||
{{#indexentry:keyword, metallic}} | {{#indexentry:keyword, metallic}} | ||
− | |||
<p>The keyword <code>metallic</code> may be used with <code>phong</code> or <code>specular</code> highlights. This keyword indicates that the color of the highlights will be calculated by an empirical function that models the reflectivity of metallic | <p>The keyword <code>metallic</code> may be used with <code>phong</code> or <code>specular</code> highlights. This keyword indicates that the color of the highlights will be calculated by an empirical function that models the reflectivity of metallic | ||
surfaces.</p> | surfaces.</p> | ||
+ | |||
<p>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</p> | <p>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</p> | ||
+ | |||
<p>The <code>metallic</code> 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.</p> | <p>The <code>metallic</code> 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.</p> | ||
+ | |||
<p>For example:</p> | <p>For example:</p> | ||
+ | |||
<pre> | <pre> | ||
finish { | finish { | ||
Line 236: | Line 301: | ||
<p>If <code>phong</code> or <code>specular</code> keywords are not specified then <code>metallic</code> has no effect.</p> | <p>If <code>phong</code> or <code>specular</code> keywords are not specified then <code>metallic</code> has no effect.</p> | ||
+ | ==Specular Reflection== | ||
{{#indexentry:reflection}} | {{#indexentry:reflection}} | ||
− | + | <p>When light does not diffuse and it <em>does</em> reflect at the same angle as it hits an object, it is called <em>specular reflection</em>. Such mirror-like reflection is controlled by the <code>reflection {...}</code> block in a <code>finish</code> statement.</p> | |
− | <p>When light does not diffuse and it <em>does</em> reflect at the same angle as it hits an object, | + | |
− | it is called <em>specular reflection</em>. Such mirror-like reflection is controlled by the | ||
− | <code>reflection {...}</code> block in a <code>finish</code> statement. | ||
− | </p> | ||
<p>Syntax:</p> | <p>Syntax:</p> | ||
<pre> | <pre> | ||
Line 247: | Line 310: | ||
reflection { | reflection { | ||
[COLOR_REFLECTION_MIN,] COLOR_REFLECTION_MAX | [COLOR_REFLECTION_MIN,] COLOR_REFLECTION_MAX | ||
− | [fresnel | + | [fresnel BOOL] |
[falloff FLOAT_FALLOFF] | [falloff FLOAT_FALLOFF] | ||
[exponent FLOAT_EXPONENT] | [exponent FLOAT_EXPONENT] | ||
Line 256: | Line 319: | ||
[interior { ior IOR }] | [interior { ior IOR }] | ||
</pre> | </pre> | ||
− | <p> | + | |
− | The simplest use would be a perfect mirror: | + | <p>The simplest use would be a perfect mirror:</p> |
− | </p> | + | |
<pre> | <pre> | ||
finish { reflection {1.0} ambient 0 diffuse 0 } | finish { reflection {1.0} ambient 0 diffuse 0 } | ||
− | </pre> | + | </pre> |
− | <p> | + | |
− | This gives the object a mirrored finish. It will reflect all other elements in the scene. | + | <p>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.</p> |
− | 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. | ||
− | </p> | ||
<p>The value can range from 0.0 to 1.0. By default there is no reflection.</p> | <p>The value can range from 0.0 to 1.0. By default there is no reflection.</p> | ||
+ | |||
<p class="Note"><strong>Note:</strong> You should be aware that:</p> | <p class="Note"><strong>Note:</strong> You should be aware that:</p> | ||
+ | |||
<ul> | <ul> | ||
− | <li> | + | <li>Adding reflection to a texture makes it take longer to render because additional rays must be traced.</li> |
− | + | <li>The reflected light may be tinted by specifying a color rather than a float. For example, <code>finish { reflection rgb <1,0,0> }</code> gives a red mirror that only reflects red light.</li> | |
− | </li> | + | <li>Although such reflection is called specular it is not controlled by the <code>specular</code> keyword. That keyword controls a specular highlight.</li> |
− | <li> | + | <li>The old syntax for simple reflection: <code>reflection COLOR</code> and <code>reflection_exponent FLOAT</code> (without braces) is still supported for backward compatibility.</li> |
− | |||
− | </li> | ||
− | <li> | ||
− | |||
− | </li> | ||
− | <li> | ||
− | |||
− | </li> | ||
</ul> | </ul> | ||
{{#indexentry:falloff, reflection}} | {{#indexentry:falloff, reflection}} | ||
{{#indexentry:reflection, falloff}} | {{#indexentry:reflection, falloff}} | ||
− | <p><code>falloff</code> sets a falloff exponent in the variable reflection. This is the exponent | + | <p><code>falloff</code> 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.</p> |
− | telling how fast the reflectivity will fall off, i.e. linear, squared, cubed, etc.</p> | ||
{{#indexentry:metallic, reflection}} | {{#indexentry:metallic, reflection}} | ||
{{#indexentry:reflection, metallic}} | {{#indexentry:reflection, metallic}} | ||
− | <p>The <code>metallic</code> keyword is similar in function to the metallic keyword | + | <p>The <code>metallic</code> 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 <code>metallic</code> 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 <code>metallic</code> keyword has on the reflected color. <code>metallic</code> uses the <em>fresnel</em> 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.</p> |
− | used for highlights in finishes: it simulates the reflective properties of metallic surfaces, | ||
− | where reflected light takes on the colour of the surface. When <code>metallic</code> 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 <code>metallic</code> | ||
− | keyword has on the reflected color. <code>metallic</code> uses the | ||
− | 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.</p> | ||
{{#indexentry:exponent, reflection}} | {{#indexentry:exponent, reflection}} | ||
{{#indexentry:exponent}} | {{#indexentry:exponent}} | ||
− | |||
{{#indexentry:reflection, exponent}} | {{#indexentry:reflection, exponent}} | ||
<p><strong>exponent</strong><br> | <p><strong>exponent</strong><br> | ||
− | + | This property predates the introduction of <em>proper</em> gamma handling. People found that it was difficult to model partially reflective surfaces in a realistic way, as middle and lower brightness objects typically looked too bright when reflected. As a means to work around the phenomenon the optional <code>exponent</code> keyword was added, producing non-linear reflection intensities. The default value of 1.0 produces a linear curve. Lower values darken middle and low intensities and keep high intensity reflections bright. While this feature may still be used for artistic effects, it is strongly discouraged for renders aiming at realism. The original phenomenon is well understood by now, and using <code>assumed_gamma 1.0</code> as recommended will avoid it entirely. | |
− | |||
− | |||
− | |||
− | partially reflective surfaces in a realistic way | ||
− | |||
− | |||
− | |||
− | a linear curve. Lower values darken middle and low intensities and | ||
− | reflections bright. | ||
− | |||
</p> | </p> | ||
{{#indexentry:variable reflection}} | {{#indexentry:variable reflection}} | ||
<p><strong>Variable reflection</strong><br> | <p><strong>Variable reflection</strong><br> | ||
− | Many materials, such as water, ceramic glaze, and linoleum are more reflective when viewed at shallow angles. | + | 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 <code>reflection {...}</code> statement. |
− | This can be simulated by also specifying a minimum reflection in the <code>reflection {...}</code> statement. | ||
<br>For example: | <br>For example: | ||
</p> | </p> | ||
Line 350: | Line 383: | ||
</p> | </p> | ||
+ | ==Conserve Energy for Reflection== | ||
{{#indexentry:conserve_energy, finish}} | {{#indexentry:conserve_energy, finish}} | ||
{{#indexentry:keyword, conserve_energy}} | {{#indexentry:keyword, conserve_energy}} | ||
− | |||
<p>One of the features in POV-Ray is variable reflection, including realistic Fresnel | <p>One of the features in POV-Ray is variable reflection, including realistic Fresnel | ||
− | reflection (see the section on | + | reflection (see the section on [[Reference:Finish#Specular Reflection|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 | 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 | conservation of energy. As the amount of light reflected changes, the amount of light | ||
Line 365: | Line 398: | ||
filter/transmit will be multiplied by 20%).</p> | filter/transmit will be multiplied by 20%).</p> | ||
+ | ==Iridescence== | ||
{{#indexentry:irid, finish}} | {{#indexentry:irid, finish}} | ||
{{#indexentry:keyword, irid}} | {{#indexentry:keyword, irid}} | ||
− | |||
<p><em>Iridescence</em>, or Newton's thin film interference, simulates | <p><em>Iridescence</em>, or Newton's thin film interference, simulates | ||
the effect of light on surfaces with a microscopic transparent film overlay. | the effect of light on surfaces with a microscopic transparent film overlay. | ||
Line 424: | Line 457: | ||
the component colors, resulting in some wavelengths being reinforced, while | the component colors, resulting in some wavelengths being reinforced, while | ||
others are cancelled out. When these components are recombined, the result is | others are cancelled out. When these components are recombined, the result is | ||
− | iridescence. See also the global setting [[Reference:Global Settings# | + | iridescence. See also the global setting [[Reference:Global Settings#Irid_Wavelength|Irid_Wavelength]] for additional information.</p> |
<p class="Note"><strong>Note:</strong> The version 3.7 iridescence feature has had a major overhaul. The syntax remains the same, however, <em>both</em> the thickness and amount values are now specified in microns. Consequently, iridescence effects will vary from previous versions.</p> | <p class="Note"><strong>Note:</strong> The version 3.7 iridescence feature has had a major overhaul. The syntax remains the same, however, <em>both</em> the thickness and amount values are now specified in microns. Consequently, iridescence effects will vary from previous versions.</p> |
Latest revision as of 20:55, 2 July 2021
How does light reflect, what happens in shadows and what kind of highlights are visible? The finish
properties of a surface can greatly affect its appearance.
The syntax for finish
is as follows:
FINISH: finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] } FINISH_ITEMS: fresnel FLOAT 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 | reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] } | subsurface { translucency COLOR } | irid { Irid_Amount [IRID_ITEMS...] | use_alpha BOOL } REFLECTION_ITEMS: COLOR_REFLECTION_MAX | fresnel BOOL | falloff FLOAT_FALLOFF | exponent FLOAT_EXPONENT | metallic FLOAT_METALLIC IRID_ITEMS: thickness Amount | turbulence Amount
Note: In versions prior to 3.6.2, identifier names were limited to 40 characters. There has been a Change removing that restriction.
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 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 and FINISH is any valid finish
statement. See #declare vs. #local for information on identifier scope.
Note: For more physical realism a Change in version 3.8 expands fresnel
angle-dependent attenuation use to now include the ambient
, diffuse
, emission
, specular
and phong
components. The details are as follows:
When used directly in the finish
block the fresnel
keyword activates Fresnel effects for all of the ambient
, diffuse
, emission
, specular
and phong
attributes. At steep viewing and/or light source angles it decreases the brightness of the specular
and phong
components. At shallow viewing angles and/or light source angles it instead decreases the brightness of the ambient
, diffuse
and emission
components. The fresnel
parameter can also be set to an intermediate value, in order to allow for the approximate modelling of anti-reflective coatings.
In the following example the diffuse
, phong
and specular
syntax, which is normally used to specify the effective bi-hemispheric albedo of that respective component, does not work as advertised when finish-level fresnel
is set to non-zero. Instead, diffuse
will specify the albedo that the object would exhibit if it had a refractive index of 1, while phong
and specular
will specify the albedo that the object would exhibit if it had an infinitely large refractive index. As a result, while you would normally want to choose parameters such that D_Value + P_Value + S_Value <= 1. With finish-level fresnel
set to a non-zero value you would want to choose parameters such that D_Value <= 1 and P_Value + S_Value <= 1. For optimal realism, you should specify the settings as noted below, and control the brightness of the diffuse
component via the layer pigment.
// general values finish { diffuse albedo D_Value phong albedo P_Value specular albedo S_Value } // optimal realism finish { diffuse albedo 1 phong albedo 0 specular albedo 1 }
Setting finish-level fresnel
will automatically activate (if set to a non-zero value) or deactivate (if set to zero) the reflection-level fresnel
parameter. This can be overridden by specifying the reflection parameters after the finish-level fresnel
parameter. For optimal realism, the maximum reflection should be set equal to the finish-level fresnel
parameter, while the minimum reflection should be set to zero.
When subsurface light transport is enabled, the finish-level fresnel
parameter will have no effect on the diffuse
attribute; instead, the feature will always act as if the parameter had been set to 1.
Radiosity-based illumination currently does not account for the Fresnel effect on incoming light, regardless of the finish-level fresnel
parameter.
New in version 3.8 you can now specify use_alpha
in the finish
block. If set to off
, the default and also the old behavior, then pigment
filter and transmit only hide the surface's diffuse
, ambient
and emission
components. If set to on
then pigment
filter and transmit also hide the surface's highlights and specular
reflection.
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. 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. For instance, when entering a room where the walls, floor and ceiling are red, 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. In that case a color value can be specified as in the example below:
finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient
If all color components are equal, a single float value may be used. In other words a 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 typically greater than 0, but negative values work too. Lastly the value can also be arbitrarily high to simulate a very 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 defined as: Ambient = Finish_Ambient * Global_Ambient_Light_Source. See also: 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.
There has been a Change as of version 3.7 in that the ambient mechanism is now automatically turned off when radiosity
is enabled, provided that #version
is set to 3.7 or higher. This will allow use of the same material definitions in both radiosity and non-radiosity scenes. As a consequence, the practice of co-opting ambient
to model glowing materials will no longer work in radiosity
scenes and is therefore strongly discouraged altogether; instead, the new emission
keyword has been added specifically for this purpose.
Note: Specular reflected indirect illumination like a flashlight shining in a mirror cannot modeled by either ambient light or radiosity. Use photons instead.
In version 3.8 there has been a Change to the ambient
default setting. The default setting is now ambient 0
as opposed to the ambient 0.1
value used in previous versions. Requires #version 3.8;
or equivalent INI setting or command-line option. See also: Version Directive.
Emission
The emission
keyword New in version 3.7 can be used to model glowing materials, eliminating the need to co-opt ambient
for this purpose.
The syntax and effect are virtually identical to ambient
, except that emission
is unaffected by the global ambient_light
parameter, and is not turned off when using radiosity.
See also: Ambient
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 fresnel }
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 }
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 first determine the proper mm_per_unit
setting (it should always match the actual scale of the object) to use in the global settings block, then adjust the materials translucency
value.
Note: Any effect that can be achieved by changing mm_per_unit
can also be achieved by adjusting the translucency
value of materials.
The mm_per_unit
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.
- To avoid seams between objects, they currently must share a common interior. It's not sufficient to have interiors with identical parameters, or even instances of the same defined interior. The only way to overcome this is to specify the interior in the parent CSG rather than the individual primitives. For the desired results:
- REMOVE any interior statements from the material.
- ADD the interior statement to the union or merge.
- For each part that needs a different
ior
(e.g. eyelashes or teeth) add an individual interior statement.
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 fresnel }
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 fresnel }
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] [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
This property predates the introduction of proper gamma handling. People found that it was difficult to model partially reflective surfaces in a realistic way, as middle and lower brightness objects typically looked too bright when reflected. As a means to work around the phenomenon the optional exponent
keyword was added, producing non-linear reflection intensities. The default value of 1.0 produces a linear curve. Lower values darken middle and low intensities and keep high intensity reflections bright. While this feature may still be used for artistic effects, it is strongly discouraged for renders aiming at realism. The original phenomenon is well understood by now, and using assumed_gamma 1.0
as recommended will avoid it entirely.
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).