Sophie

Sophie

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

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.4.9 Object Modifiers</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_112.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_112.html">3.4.8 Light Groups</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.4.9 
   Object Modifiers</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_114.html">3.5 Textures</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_114.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 
<h3><a name="s03_04_09">3.4.9 </a>Object Modifiers</h3>

<p>
  A variety of modifiers may be attached to objects. The following items may be applied to any object: 
</p>

<pre>
OBJECT_MODIFIER:
   clipped_by { UNTEXTURED_SOLID_OBJECT... } |
   clipped_by { bounded_by }                 |
   bounded_by { UNTEXTURED_SOLID_OBJECT... } |
   bounded_by { clipped_by }                 |
   no_shadow                  |
   no_image [ Bool ]          |
   no_reflection [ Bool ]     |
   inverse                    |
   sturm [ Bool ]             |
   hierarchy [ Bool ]         |
   double_illuminate [ Bool ] |
   hollow  [ Bool ]           |
   interior { INTERIOR_ITEMS... }                        |
   material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] } |
   texture { TEXTURE_BODY }   |
   interior_texture { TEXTURE_BODY } |
   pigment { PIGMENT_BODY }   |
   normal { NORMAL_BODY }     |
   finish { FINISH_ITEMS... } |
   photons { PHOTON_ITEMS...}
   TRANSFORMATION
</pre>

<p>
  Transformations such as translate, rotate and scale have already been discussed. The modifiers &quot;Textures&quot; 
 and its parts &quot;Pigment&quot;, &quot;Normal&quot;, and &quot;Finish&quot; as well as &quot;Interior&quot;, and 
 &quot;Media&quot; (which is part of interior) are each in major chapters of their own below. In the sub-sections below 
 we cover several other important modifiers: <code>clipped_by</code>, <code>bounded_by</code>, <code>material</code>, <code>inverse</code>, 
 <code>hollow</code>, <code>no_shadow</code>, <code>no_image</code>, <code>no_reflection</code>, <code>double_illuminate</code> 
 and <code>sturm</code>. Although the examples below use object statements and object identifiers, these modifiers may 
 be used on any type of object such as sphere, box etc. 
</p>

<h4><a name="s03_04_09_01">3.4.9.1 </a>Clipped_By</h4>
<a name="s03_04_09_01_i1"><a name="clipped_by"></a><a name="s03_04_09_01_i2"><a name="clipped_by, object modifier"></a><a name="s03_04_09_01_i3">
<p>
  The <code>clipped_by</code> statement is technically an object modifier but it provides a type of CSG similar to 
 CSG intersection. The syntax is: 
</p>

<pre>
CLIPPED_BY:
    clipped_by { UNTEXTURED_SOLID_OBJECT... } |
    clipped_by { bounded_by }
</pre>

<p>
  Where <em>UNTEXTURED_SOLID_OBJECT</em> is one or more solid objects which have had no texture applied. For example: 
</p>

<pre>
  object {
    My_Thing
    clipped_by{plane{y,0}}
  }
</pre>

<p>
  Every part of the object <code>My_Thing</code> that is inside the plane is retained while the remaining part is 
 clipped off and discarded. In an <code> intersection</code> object the hole is closed off. With <code> clipped_by</code> 
 it leaves an opening. For example the following figure shows object <code>A</code> being clipped by object <code>B</code>. 
 
</p>

<p>
  <br><center><img alt="An object clipped by another object." src="images/reference/clipobj.png"></center> 
</p>

<p>
  You may use <code>clipped_by</code> to slice off portions of any shape. In many cases it will also result in faster 
 rendering times than other methods of altering a shape. Occasionally you will want to use the <code> clipped_by</code> 
 and <code>bounded_by</code> options with the same object. The following shortcut saves typing and uses less memory. 
</p>

<pre>
  object {
    My_Thing
    bounded_by { box { &lt;0,0,0&gt;, &lt;1,1,1&gt; } }
    clipped_by { bounded_by }
  }
</pre>

<p>
  This tells POV-Ray to use the same box as a clip that was used as a bound. 
</p>

<h4><a name="s03_04_09_02">3.4.9.2 </a>Bounded_By</h4>
<a name="s03_04_09_02_i1"><a name="bounded_by"></a><a name="s03_04_09_02_i2"><a name="bounded_by, object modifier"></a><a name="s03_04_09_02_i3">
<p>
  The calculations necessary to test if a ray hits an object can be quite time consuming. Each ray has to be tested 
 against every object in the scene. POV-Ray attempts to speed up the process by building a set of invisible boxes, 
 called bounding boxes, which cluster the objects together. This way a ray that travels in one part of the scene does 
 not have to be tested against objects in another, far away part of the scene. When a large number of objects are 
 present the boxes are nested inside each other. POV-Ray can use bounding boxes on any finite object and even some 
 clipped or bounded quadrics. However infinite objects (such as a planes, quartic, cubic and poly) cannot be 
 automatically bound. CSG objects are automatically bound if they contain finite (and in some cases even infinite) 
 objects. This works by applying the CSG set operations to the bounding boxes of all objects used inside the CSG 
 object. For difference and intersection operations this will hardly ever lead to an optimal bounding box. It is 
 sometimes better (depending on the complexity of the CSG object) to have you place a bounding shape yourself using a <code> 
 bounded_by</code> statement. 
</p>

<p>
  Normally bounding shapes are not necessary but there are cases where they can be used to speed up the rendering of 
 complex objects. Bounding shapes tell the ray-tracer that the object is totally enclosed by a simple shape. When 
 tracing rays, the ray is first tested against the simple bounding shape. If it strikes the bounding shape the ray is 
 further tested against the more complicated object inside. Otherwise the entire complex shape is skipped, which 
 greatly speeds rendering. The syntax is: 
</p>

<pre>
BOUNDED_BY:
    bounded_by { UNTEXTURED_SOLID_OBJECT... } |
    bounded_by { clipped_by }
</pre>

<p>
  Where <em>UNTEXTURED_SOLID_OBJECT</em> is one or more solid objects which have had no texture applied. For example: 
</p>

<pre>
  intersection {
    sphere { &lt;0,0,0&gt;, 2 }
    plane  { &lt;0,1,0&gt;, 0 }
    plane  { &lt;1,0,0&gt;, 0 }
    bounded_by { sphere { &lt;0,0,0&gt;, 2 } }
  }
</pre>

<p>
  The best bounding shape is a sphere or a box since these shapes are highly optimized, although, any shape may be 
 used. If the bounding shape is itself a finite shape which responds to bounding slabs then the object which it 
 encloses will also be used in the slab system. 
</p>

<p>
  While it may a good idea to manually add a <code>bounded_by</code> to intersection, difference and merge, it is 
 best to <em>never</em> bound a union. If a union has no <code> bounded_by</code> POV-Ray can internally split apart 
 the components of a union and apply automatic bounding slabs to any of its finite parts. Note that some utilities such 
 as <code> raw2pov</code> may be able to generate bounds more efficiently than POV-Ray's current system. However most 
 unions you create yourself can be easily bounded by the automatic system. For technical reasons POV-Ray cannot split a 
 merge object. It is maybe best to hand bound a merge, especially if it is very complex. 
</p>

<p class="Note">
  <strong>Note:</strong> if bounding shape is too small or positioned incorrectly it may clip the object 
 in undefined ways or the object may not appear at all. To do true clipping, use <code>clipped_by</code> as explained 
 in the previous section. Occasionally you will want to use the <code>clipped_by</code> and <code>bounded_by</code> 
 options with the same object. The following shortcut saves typing and uses less memory. 
</p>

<pre>
  object {
    My_Thing
    clipped_by{ box { &lt;0,0,0&gt;,&lt;1,1,1 &gt; }}
    bounded_by{ clipped_by }
  }
</pre>

<p>
  This tells POV-Ray to use the same box as a bound that was used as a clip. 
</p>

<h4><a name="s03_04_09_03">3.4.9.3 </a>Material</h4>
<a name="s03_04_09_03_i1"><a name="material"></a><a name="s03_04_09_03_i2"><a name="material, object modifier"></a><a name="s03_04_09_03_i3">
<p>
  One of the changes in POV-Ray 3.1 was the removal of several items from <code> texture { finish{</code>...<code>} }</code> 
 and to move them to the new <code> interior</code> statement. The <code><a href="s_118.html#s03_05_04">halo</a></code> 
 statement, formerly part of <code><a href="#l137">texture</a></code>, is now renamed <code><a href="#l138">media</a></code> 
 and made a part of the <code><a href="#l139">interior</a></code>. 
</p>

<p>
  This split was deliberate and purposeful (see &quot;<a href="s_128.html#s03_06_01_01">Why are Interior and Media 
 Necessary?</a>&quot;) however beta testers pointed out that it made it difficult to entirely describe the surface 
 properties and interior of an object in one statement that can be referenced by a single identifier in a texture 
 library. 
</p>

<p>
  The result is that we created a &quot;wrapper&quot; around <code> texture</code> and <code> interior</code> which 
 we call <code>material</code>. 
</p>

<p>
  The syntax is: 
</p>

<pre>
MATERIAL:
    material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] }
MATERIAL_ITEMS:
    TEXTURE | INTERIOR_TEXTURE | INTERIOR | TRANSFORMATIONS
</pre>

<p>
  For example: 
</p>

<pre>
#declare MyGlass=material{ texture{ Glass_T } interior{ Glass_I }}
object { MyObject material{ MyGlass}}
</pre>

<p>
  Internally, the &quot;material&quot; is not attached to the object. The material is just a container that brings 
 the texture and interior to the object. It is the texture and interior itself that is attached to the object. Users 
 should still consider texture and interior as separate items attached to the object. 
</p>

<p>
  The material is just a &quot;bucket&quot; to carry them. If the object already has a texture, then the material 
 texture is layered over it. If the object already has an interior, the material interior fully replaces it and the old 
 interior is destroyed. Transformations inside the material affect only the textures and interiors which are inside the <code> 
 material{}</code> wrapper and only those textures or interiors specified are affected. For example: 
</p>

<pre>
  object {
    MyObject
    material {
      texture { MyTexture }
      scale 4         //affects texture but not object or interior
      interior { MyInterior }
      translate 5*x   //affects texture and interior, not object
    }
  }
</pre>

<p class="Note">
  <strong>Note:</strong> The <code>material</code> statement has nothing to do with the <code><a href="s_119.html#s03_05_05_03">material_map</a></code> 
 statement. A <code>material_map</code> is <em> not</em> a way to create patterned material. See &quot;<a href="s_119.html#s03_05_05_03">Material 
 Maps</a>&quot; for explanation of this unrelated, yet similarly named, older feature. 
</p>

<h4><a name="s03_04_09_04">3.4.9.4 </a>Inverse</h4>
<a name="s03_04_09_04_i1"><a name="inverse"></a><a name="s03_04_09_04_i2"><a name="inverse, object modifier"></a><a name="s03_04_09_04_i3">
<p>
  When using <a href="#l140">CSG</a> it is often useful to invert an object so that it will be inside-out. The 
 appearance of the object is not changed, just the way that POV-Ray perceives it. When the <code>inverse</code> keyword 
 is used the <em> inside</em> of the shape is flipped to become the <em>outside</em> and vice versa. For example: 
</p>

<pre>
  object { MyObject inverse }
</pre>

<p>
  The inside/outside distinction is also important when attaching <code><a href="#l139">interior</a></code> to an 
 object especially if <code><a href="#l138">media</a></code> is also used. Atmospheric media and fog also do not work 
 as expected if your camera is inside an object. Using <code>inverse</code> is useful to correct that problem. 
</p>

<h4><a name="s03_04_09_05">3.4.9.5 </a>Hollow</h4>
<a name="s03_04_09_05_i1"><a name="hollow"></a><a name="s03_04_09_05_i2"><a name="hollow, object modifier"></a><a name="s03_04_09_05_i3">
<p>
  POV-Ray by default assumes that objects are made of a solid material that completely fills the interior of an 
 object. By adding the <code> hollow</code> keyword to the object you can make it hollow, also see the <a href="s_128.html#s03_06_01_02">&quot;Empty 
 and Solid Objects&quot;</a> chapter. That is very useful if you want atmospheric effects to exist inside an object. It 
 is even required for objects containing an interior media. The keyword may optionally be followed by a float 
 expression which is interpreted as a boolean value. For example <code>hollow off</code> may be used to force it off. 
 When the keyword is specified alone, it is the same as <code>hollow on</code>. By default <code>hollow</code> is <code>off</code> 
 when not specified. 
</p>

<p>
  In order to get a hollow CSG object you just have to make the top level object hollow. All children will assume the 
 same <code> hollow</code> state except when their state is explicitly set. The following example will set both spheres 
 inside the union hollow 
</p>

<pre>
  union {
    sphere { -0.5*x, 1 }
    sphere {  0.5*x, 1 }
    hollow
  }
</pre>

<p>
  while the next example will only set the second sphere hollow because the first sphere was explicitly set to be not 
 hollow. 
</p>

<pre>
  union {
    sphere { -0.5*x, 1 hollow off }
    sphere {  0.5*x, 1 }
    hollow on
  }
</pre>

<h4><a name="s03_04_09_06">3.4.9.6 </a>No_Shadow</h4>
<a name="s03_04_09_06_i1"><a name="no_shadow"></a><a name="s03_04_09_06_i2"><a name="no_shadow, object modifier"></a><a name="s03_04_09_06_i3">
<p>
  You may specify the <code>no_shadow</code> keyword in an object to make that object cast no shadow. This is useful 
 for special effects and for creating the illusion that a light source actually is visible. This keyword was necessary 
 in earlier versions of POV-Ray which did not have the <code> looks_like</code> statement. Now it is useful for 
 creating things like laser beams or other unreal effects. During test rendering it speeds things up if <code>no_shadow</code> 
 is applied. 
</p>

<p>
  Simply attach the keyword as follows: 
</p>

<pre>
  object {
    My_Thing
    no_shadow
  }
</pre>

<h4><a name="s03_04_09_07">3.4.9.7 </a>No_Image, No_Reflection</h4>
<a name="s03_04_09_07_i1"><a name="no image"></a><a name="s03_04_09_07_i2"><a name="no reflection"></a><a name="s03_04_09_07_i3"><a name="no_image"></a><a name="s03_04_09_07_i4"><a name="no_image, object modifier"></a><a name="s03_04_09_07_i5"><a name="s03_04_09_07_i6"><a name="no_reflection"></a><a name="s03_04_09_07_i7"><a name="no_reflection, object modifier"></a><a name="s03_04_09_07_i8">
<p>
  Syntax: 
</p>

<pre>
  OBJECT {
    [OBJECT_ITEMS...]
    no_image
    no_reflection
  }
</pre>

<p>
  These two keywords are very similar in usage and function to the <code>no_shadow</code> keyword, and control an 
 object's visibility. <br>You can use any combination of the three with your object. 
</p>

<p>
  When <code>no_image</code> is used, the object will not be seen by the camera, either directly or through 
 transparent/refractive objects. However, it will still cast shadows, and show up in reflections (unless <code>no_reflection 
 </code> and/or <code>no_shadow</code> is used also). 
</p>

<p>
  When <code>no_reflection</code> is used, the object will not show up in reflections. It will be seen by the camera 
 (and through transparent/refractive objects) and cast shadows, unless <code>no_image</code> and/or <code>no_shadow </code> 
 is used. 
</p>

<p>
  Using these three keywords you can produce interesting effects like a sphere casting a rectangular shadow, a cube 
 that shows up as a cone in mirrors, etc. 
</p>

<h4><a name="s03_04_09_08">3.4.9.8 </a>Double_Illuminate</h4>
<a name="s03_04_09_08_i1"><a name="double_illuminate"></a><a name="s03_04_09_08_i2"><a name="double_illuminate, object modifier"></a><a name="s03_04_09_08_i3">
<p>
  Syntax: 
</p>

<pre>
  OBJECT {
    [OBJECT_ITEMS...]
    double_illuminate
  }
</pre>

<p>
  A surface has two sides; usually, only the side facing the light source is illuminated, the other side remains in 
 shadow. When <code>double_illuminate</code> is used, the other side is also illuminated. <br>This is useful for 
 simulating effects like translucency (as in a lamp shade, sheet of paper, etc). 
</p>

<p class="Note">
  <strong>Note:</strong> <code>double_illuminate</code> only illuminates both sides of the same surface, 
 so on a sphere, for example, you will not see the effect unless the sphere is either partially transparent, or if the 
 camera is inside and the light source outside of the sphere (or vise versa). 
</p>

<h4><a name="s03_04_09_09">3.4.9.9 </a>Sturm</h4>
<a name="s03_04_09_09_i1"><a name="sturm"></a><a name="s03_04_09_09_i2"><a name="sturm, object modifier"></a><a name="s03_04_09_09_i3">
<p>
  Some of POV-Ray's objects allow you to choose between a fast but sometimes inaccurate root solver and a slower but 
 more accurate one. This is the case for all objects that involve the solution of a cubic or quartic polynomial. There 
 are analytic mathematical solutions for those polynomials that can be used. 
</p>

<p>
  Lower order polynomials are trivial to solve while higher order polynomials require iterative algorithms to solve 
 them. One of those algorithms is the Sturmian root solver. For example: 
</p>

<pre>
  blob {
    threshold .65
    sphere { &lt;.5,0,0&gt;, .8, 1 }
    sphere { &lt;-.5,0,0&gt;,.8, 1 }
    sturm
  }

</pre>

<p>
  The keyword may optionally be followed by a float expression which is interpreted as a boolean value. For example <code>sturm 
 off</code> may be used to force it off. When the keyword is specified alone, it is the same as <code>sturm on</code>. 
 By default <code>sturm</code> is <code>off</code> when not specified. 
</p>

<p>
  The following list shows all objects for which the Sturmian root solver can be used. 
</p>

<ul>
 
 <li>
   blob 
 </li>

 <li>
   cubic 
 </li>

 <li>
   lathe (only with quadratic splines) 
 </li>

 <li>
   poly 
 </li>

 <li>
   prism (only with cubic splines) 
 </li>

 <li>
   quartic 
 </li>

 <li>
   sor 
 </li>

</ul>

<p>
 <a name="l137">
<small><strong>More about &quot;texture&quot;</strong></small>
</a>
 <ul>
  
  <li><small>
   <a href="s_114.html#s03_05">3.5 Textures</a> in 3 POV-Ray Reference
  </small>

  <li><small>
   <a href="s_162.html#s03_08_10">3.8.10 Texture</a> in 3.8 Quick Reference
  </small>

 </ul>

</p>

<p>
 <a name="l138">
<small><strong>More about &quot;media&quot;</strong></small>
</a>
 <ul>
  
  <li><small>
   <a href="s_129.html#s03_06_02">3.6.2 Media</a> in 3.6 Interior &amp; Media &amp; Photons
  </small>

  <li><small>
   <a href="s_163.html#s03_08_11">3.8.11 Media</a> in 3.8 Quick Reference
  </small>

 </ul>

</p>

<p>
 <a name="l139">
<small><strong>More about &quot;interior&quot;</strong></small>
</a>
 <ul>
  
  <li><small>
   <a href="s_128.html#s03_06_01">3.6.1 Interior</a> in 3.6 Interior &amp; Media &amp; Photons
  </small>

  <li><small>
   <a href="s_161.html#s03_08_09_03">3.8.9.3 Interior</a> in 3.8.9 Object Modifiers
  </small>

 </ul>

</p>

<p>
 <a name="l140">
<small><strong>More about &quot;CSG&quot;</strong></small>
</a>
 <ul>
  
  <li><small>
   <a href="s_110.html#s03_04_06">3.4.6 Constructive Solid Geometry</a> in 3.4 Objects
  </small>

  <li><small>
   <a href="s_160.html#s03_08_08_06">3.8.8.6 CSG</a> in 3.8.8 Objects
  </small>

 </ul>

</p>
 <br> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_112.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_112.html">3.4.8 Light Groups</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong>3.4.9 Object Modifiers</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_114.html">3.5 Textures</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_114.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 </body> </html>