Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 8c84ab5fe0ecd5f81b4e4e07120af05b > files > 389

povray-3.6.1-8mdv2010.1.i586.rpm


<!--  This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004  -->
<html> 
<head>
  
<!--  NOTE: In order to users to help find information about POV-Ray using  -->
 
<!--  web search engines, we ask you to *not* let them index documentation  -->
 
<!--  mirrors because effectively, when searching, users will get hundreds  -->
 
<!--  of results containing the same information! For this reason, the two  -->
 
<!--  meta tags below disable archiving and indexing of this page by all  -->
 
<!--  search engines that support these meta tags.  -->
 
 <meta content="noarchive" name="robots">
   
 <meta content="noindex" name="robots">
   
 <meta content="no-cache" http-equiv="Pragma">
   
 <meta content="0" http-equiv="expires">
   
<title>3.5.3 Finish</title>
 <link href="povray35.css" rel="stylesheet" type="text/css"> 
</head>
 <body> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_116.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_116.html">3.5.2 Normal</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.5.3 
   Finish</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_118.html">3.5.4 Halo</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_118.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 
<h3><a name="s03_05_03">3.5.3 </a>Finish</h3>
<a name="s03_05_03_i1"><a name="finish"></a><a name="s03_05_03_i2"><a name="finish, keyword"></a><a name="s03_05_03_i3"><a name="s03_05_03_i4"><a name="ambient, finish"></a><a name="s03_05_03_i5"><a name="s03_05_03_i6"><a name="diffuse, finish"></a><a name="s03_05_03_i7"><a name="s03_05_03_i8"><a name="brilliance, finish"></a><a name="s03_05_03_i9"><a name="s03_05_03_i10"><a name="phong, finish"></a><a name="s03_05_03_i11"><a name="s03_05_03_i12"><a name="phong_size, finish"></a><a name="s03_05_03_i13"><a name="s03_05_03_i14"><a name="specular, finish"></a><a name="s03_05_03_i15"><a name="s03_05_03_i16"><a name="roughness, finish"></a><a name="s03_05_03_i17"><a name="s03_05_03_i18"><a name="metallic, finish"></a><a name="s03_05_03_i19"><a name="s03_05_03_i20"><a name="crand, finish"></a><a name="s03_05_03_i21"><a name="s03_05_03_i22"><a name="conserve_energy, finish"></a><a name="s03_05_03_i23"><a name="s03_05_03_i24"><a name="irid, finish"></a><a name="s03_05_03_i25"><a name="s03_05_03_i26"><a name="fresnel, finish"></a><a name="s03_05_03_i27"><a name="s03_05_03_i28"><a name="falloff, finish"></a><a name="s03_05_03_i29"><a name="s03_05_03_i30"><a name="exponent, finish"></a><a name="s03_05_03_i31"><a name="s03_05_03_i32"><a name="thickness, finish"></a><a name="s03_05_03_i33"><a name="s03_05_03_i34"><a name="turbulence, finish"></a><a name="s03_05_03_i35">
<p>
  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 <code>finish</code>. 
</p>

<p>
  The syntax for <code>finish</code> is as follows:<a name="s03_05_03_i36"><a name="ambient"></a> 
</p>

<pre>
FINISH:
    finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] }
FINISH_ITEMS:
    ambient COLOR | diffuse Amount | brilliance Amount |
    phong Amount | phong_size Amount | specular Amount |
    roughness Amount | metallic [Amount] | reflection COLOR |
    crand Amount | conserve_energy BOOL_ON_OF |
    reflection { Color_Reflecting_Min [REFLECTION_ITEMS...] }|
    irid { Irid_Amount [IRID_ITEMS...] }
REFLECTION_ITEMS:
    COLOR_REFLECTION_MAX | fresnel BOOL_ON_OFF |
    falloff FLOAT_FALLOFF | exponent FLOAT_EXPONENT |
    metallic FLOAT_METALLIC
IRID_ITEMS:
    thickness Amount | turbulence Amount
</pre>

<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>
  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 &quot;<a href="s_128.html#s03_06_01_01">Why are Interior and Media Necessary?</a>&quot; for 
 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 that it as part of a texture. For example instead of this: 
</p>

<pre>
  object { My_Object texture { finish { phong 0.5 } } }
</pre>

<p>
  you may shorten it to: 
</p>

<pre>
  object { My_Object finish { phong 0.5 } }
</pre>

<p>
  Doing so creates an entire <code>texture</code> structure with default <code>pigment</code> and <code>normal</code> 
 statements just as if you had explicitly typed the full <code> texture {...}</code> around it. 
</p>

<p>
  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. 
</p>

<pre>
FINISH_DECLARATION:
    #declare IDENTIFIER = FINISH |
    #local IDENTIFIER = FINISH
</pre>

<p>
  Where <em>IDENTIFIER</em> is the name of the identifier up to 40 characters long and <em>FINISH</em> is any valid <code>finish</code> 
 statement. See &quot;<a href="s_98.html#s03_02_02_02_02">#declare vs. #local</a>&quot; for information on identifier 
 scope. 
</p>

<h4><a name="s03_05_03_01">3.5.3.1 </a>Ambient</h4>

<p>
  The light you see in dark shadowed areas comes from diffuse reflection off of other objects. This light cannot be 
 directly modeled using ray-tracing. However we can use a trick called <em>ambient lighting</em> to simulate the light 
 inside a shadowed area. 
</p>

<p>
  Ambient light is light that is scattered everywhere in the room. It bounces all over the place and manages to light 
 objects up a bit even where no light is directly shining. Computing real ambient light would take far too much time, 
 so we simulate ambient light by adding a small amount of white light to each texture whether or not a light is 
 actually shining on that texture. 
</p>

<p>
  This means that the portions of a shape that are completely in shadow will still have a little bit of their surface 
 color. It is almost as if the texture glows, though the ambient light in a texture only affects the shape it is used 
 on. 
</p>

<p>
  The <code>ambient</code> keyword controls the amount of ambient light. Usually a single float value is specified 
 even though the syntax calls for a color. For example a float value of <code>0.3</code> gets promoted to the full 
 color vector <code> &lt;0.3,0.3,0.3,0.3,0.3&gt;</code> which is acceptable because only the red, green and blue parts 
 are used. 
</p>

<p>
  The default value is 0.1 which gives very little ambient light. The value can range from 0.0 to 1.0. Ambient light 
 affects both shadowed and non-shadowed areas so if you turn up the <code> ambient</code> value you may want to turn 
 down the <code>diffuse</code> and <code>reflection</code> values. 
</p>

<p class="Note">
  <strong>Note:</strong> that this method does not account for the color of surrounding objects. If you 
 walk into a room that has red walls, floor and ceiling then your white clothing will look pink from the reflected 
 light. POV-Ray's ambient shortcut does not account for this. There is also no way to model specular reflected indirect 
 illumination such as the flashlight shining in a mirror. 
</p>

<p>
  You may color the ambient light using one of two methods. You may specify a color rather than a float after the 
 ambient keyword in each finish statement. For example 
</p>

<pre>
   finish { ambient rgb &lt;0.3,0.1,0.1&gt; } //a pink ambient
</pre>

<p>
  You may also specify the overall ambient light source used when calculating the ambient lighting of an object using 
 the global <code> ambient_light</code> setting. The formula is given by <em> Ambient = Finish_Ambient * 
 Global_Ambient_Light_Source</em> See section &quot;<a href="s_102.html#s03_03_03_02">Ambient Light</a>&quot; for 
 details. 
</p>

<h4><a name="s03_05_03_02">3.5.3.2 </a>Diffuse Reflection Items</h4>

<p>
  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 <em>specular reflection</em>. 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 <em>diffuse reflection</em> because the light diffuses or spreads in a variety of directions. It 
 accounts for the majority of the reflected light we see. 
</p>

<h5><a name="s03_05_03_02_01">3.5.3.2.1 </a>Diffuse</h5>

<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. For example 
</p>

<pre>
  finish { diffuse 0.7 }
</pre>

<p>
  means that 70% of the light seen comes from direct illumination from light sources. The default value is <code>diffuse 
 0.6</code>. 
</p>

<h5><a name="s03_05_03_02_02">3.5.3.2.2 </a>Brilliance</h5>
<a name="s03_05_03_02_02_i1"><a name="brilliance"></a>
<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>

<h5><a name="s03_05_03_02_03">3.5.3.2.3 </a>Crand Graininess</h5>
<a name="s03_05_03_02_03_i1"><a name="crand"></a>
<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>
  finish { crand 0.05 }
</pre>

<p>
  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. 
</p>

<p class="Note">
  <strong>Note:</strong> this should not be used when rendering animations. This is the one of a few 
 truly random features in POV-Ray and will produce an annoying flicker of flying pixels on any textures animated with a <code>crand</code> 
 value. For these reasons it is not a very accurate way to model the rough surface effect. 
</p>

<h4><a name="s03_05_03_03">3.5.3.3 </a>Highlights</h4>

<p>
  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 <em>specular</em> 
 and <em>Phong</em> models. 
</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>

<h5><a name="s03_05_03_03_01">3.5.3.3.1 </a>Phong Highlights</h5>
<a name="s03_05_03_03_01_i1"><a name="phong"></a><a name="s03_05_03_03_01_i2"><a name="phong_size"></a>
<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>

<p>
  The Phong method measures the average of the facets facing in the mirror direction from the light sources to the 
 viewer. 
</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 <code>phong 0.0</code> gives no highlight. 
</p>

<p>
  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. 
</p>

<p>
  Typical values range from 1.0 (very dull) to 250 (highly polished) though any values may be used. Default phong 
 size is 40 (plastic) if <code> phong_size</code> is not specified. For example: 
</p>

<pre>
  finish { phong 0.9 phong_size 60 }
</pre>

<p>
  If <code>phong</code> is not specified <code>phong_size</code> has no effect. 
</p>

<h5><a name="s03_05_03_03_02">3.5.3.3.2 </a>Specular Highlight</h5>
<a name="s03_05_03_03_02_i1"><a name="specular"></a>
<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 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 <code>specular 0.0</code> gives no highlight. 
</p>

<p>
  <a name="s03_05_03_03_02_i2"><a name="roughness"></a> 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>
  It is possible to specify wrong values for roughness that will generate an error when you try to render the file. 
 Do not use 0 and if you get errors check to see if you are using a very, very small roughness value that may be 
 causing the error. For example: 
</p>

<pre>
  finish { specular 0.9 roughness 0.02 }
</pre>

<p>
  If <code>specular</code> is not specified <code>roughness</code> has no effect. 
</p>

<p class="Note">
  <strong>Note:</strong> that 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>

<h5><a name="s03_05_03_03_03">3.5.3.3.3 </a>Metallic Highlight Modifier</h5>
<a name="s03_05_03_03_03_i1"><a name="metallic"></a><a name="s03_05_03_03_03_i2"><a name="metallic, highlight"></a>
<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>

<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 one. For example: 
</p>

<pre>
  finish {
    phong 0.9
    phong_size 60
    metallic
  }
</pre>

<p>
  If <code>phong</code> or <code>specular</code> keywords are not specified then <code>metallic</code> has no effect. 
</p>

<h4><a name="s03_05_03_04">3.5.3.4 </a>Specular Reflection</h4>
<a name="s03_05_03_04_i1"><a name="reflection"></a>
<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>

<pre>  
finish {
    reflection {
      [COLOR_REFLECTION_MIN,] COLOR_REFLECTION_MAX
      [fresnel BOOL_ON_OFF]
      [falloff FLOAT_FALLOFF]
      [exponent FLOAT_EXPONENT]
      [metallic FLOAT_METALLIC]
    }
  }
[interior { ior IOR }]

</pre>

<p>
  The simplest use would be a perfect mirror: 
</p>

<pre>
  finish { reflection {1.0} ambient 0 diffuse 0 }
</pre>

<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 &lt;0.3,0.3,0.3,0.3,0.3&gt; 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 class="Note">
  <strong>Note:</strong> 
</p>

<ul>
 
 <li>
   Adding reflection to a texture makes it take longer to render because an additional ray must be traced. 
 </li>

 <li>
   The reflected light may be tinted by specifying a color rather than a float.<br> For example: <br> <code> finish 
  { reflection rgb &lt;1,0,0&gt; }</code> <br> gives a red mirror that only reflects red light. 
 </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>
   The old syntax for simple reflection: &quot;<code>reflection COLOR</code>&quot; and &quot;reflection_exponent 
  Float&quot; without braces is still supported for backward compatibility. 
 </li>

</ul>

<p>
  <a name="s03_05_03_04_i2"><a name="falloff, reflection"></a> <a name="s03_05_03_04_i3"><a name="reflection, falloff"></a> 
 <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>

<p>
  <a name="s03_05_03_04_i4"><a name="metallic, reflection"></a> <a name="s03_05_03_04_i5"><a name="refelection, metallic"></a> 
 The <code> metallic</code> keyword is similar in function to the &quot;metallic&quot; 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 &quot;reflection&quot; 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 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.<a name="s03_05_03_04_i6"><a name="exponent, reflection"></a><a name="s03_05_03_04_i7"><a name="exponent"></a><a name="s03_05_03_04_i8"><a name="reflection_exponent"></a><a name="s03_05_03_04_i9"> 
 
</p>

<p>
  <strong>exponent</strong><br> 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 <code>rgb&lt;1,1,1&gt;</code> 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 <code>reflection</code> value, it tends 
 to darken the bright objects too much. Therefore the optional <code>exponent</code> 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. 
</p>

<p>
  <strong>Variable reflection</strong><br> <a name="s03_05_03_04_i10"><a name="variable reflection"></a> 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. <br>For example: 
</p>

<pre>
    finish { reflection { 0.03, 1 }}
</pre>

<p>
  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. <br> 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. 
</p>

<p class="Note">
  <strong>Note:</strong> You can make maximum reflection less than minimum reflection if you want, 
 although the result is something that does not occur in nature. <a name="s03_05_03_04_i11"><a name="fresnel"></a> 
</p>

<p>
  When adding the <code>fresnel</code> 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 <code>interior { 
 ior IOR }</code> 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. 
</p>

<h4><a name="s03_05_03_05">3.5.3.5 </a>Conserve Energy for Reflection</h4>
<a name="s03_05_03_05_i1"><a name="conserve_energy"></a>
<p>
  One of the features in POV-Ray is variable reflection, including realistic Fresnel reflection (see section &quot;<a href="s_117.html#s03_05_03_04">Variable 
 Reflection</a> &quot;). Unfortunately, when this is coupled with constant transmittance, the texture can look 
 unrealistic. This unrealism is caused by the scene breaking the law of conservation of energy. As the amount of light 
 reflected changes, the amount of light transmitted should also change (in a give-and-take relationship). 
</p>

<p>
  This can be achieved by adding the <code>conserve_energy</code> keyword to the object's <code>finish {}</code>. <br>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%). 
</p>

<h4><a name="s03_05_03_06">3.5.3.6 </a>Iridescence</h4>
<a name="s03_05_03_06_i1"><a name="irid"></a>
<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 is like an oil slick on a puddle of water or the rainbow hues of a 
 soap bubble. This effect is controlled by the <code> irid</code> statement specified inside a <code>finish</code> 
 statement. 
</p>

<p>
  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. 
</p>

<p>
  The syntax is: 
</p>

<pre>
IRID:
    irid { Irid_Amount [IRID_ITEMS...] }
IRID_ITEMS:
    thickness Amount | turbulence Amount
</pre>

<p>
  The required <em><code>Irid_Amount</code></em> 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 <code> diffuse</code> and possibly the <code>ambient</code> values 
 of the surface. 
</p>

<p>
  <a name="s03_05_03_06_i2"><a name="thickness"></a> The <code> thickness</code> 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 <em> busy-ness</em> 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. 
</p>

<p>
  <a name="s03_05_03_06_i3"><a name="turbulence, irid"></a> The thickness of the film can be varied with the <code> 
 turbulence</code> 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 <code>turbulence</code> 
 keyword. 
</p>

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

<p>
  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 <em>subsurface</em> 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. 
</p>

<p>
  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 &quot;<a href="s_102.html#s03_03_03_05">Irid_Wavelength</a>&quot;. 
</p>

<p>
  The concept used for this feature came from the book <em>Fundamentals of Three-Dimensional Computer Graphics</em> 
 by Alan Watt (Addison-Wesley). 
</p>
 <br> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_116.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_116.html">3.5.2 Normal</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong>3.5.3 Finish</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_118.html">3.5.4 Halo</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_118.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 </body> </html>