Difference between revisions of "Reference:Pigment Map"

From POV-Wiki
Jump to navigation Jump to search
m (1 revision: link repair)
m (corrections)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{#indexentry:pigments, pigment list}}
 
{{#indexentry:pigments, pigment list}}
 
{{#indexentry:pigment_map}}
 
{{#indexentry:pigment_map}}
 +
{{#indexentry:blend_map}}
 +
{{#indexentry:blend_gamma}}
 
<p>In addition to specifying blended colors with a color map you may create a blend of pigments using a  <code>pigment_map</code>. The syntax for a pigment map is identical to a color map except you specify a pigment in each map
 
<p>In addition to specifying blended colors with a color map you may create a blend of pigments using a  <code>pigment_map</code>. The syntax for a pigment map is identical to a color map except you specify a pigment in each map
entry (and not a color).</p>
+
entry and not a color. {{New}} in version 3.8 non-linear pigment map interpolation support has been added.</p>
 +
 
 
<p>The syntax for <code>pigment_map</code> is as follows:</p>
 
<p>The syntax for <code>pigment_map</code> is as follows:</p>
 
<pre>
 
<pre>
Line 8: Line 11:
 
   pigment_map { PIGMENT_MAP_BODY }
 
   pigment_map { PIGMENT_MAP_BODY }
 
PIGMENT_MAP_BODY:
 
PIGMENT_MAP_BODY:
   PIGMENT_MAP_IDENTIFIER | PIGMENT_MAP_ENTRY...
+
   PIGMENT_MAP_IDENTIFIER |
 +
  [BLEND_MAP_MODIFIERS...] PIGMENT_MAP_ENTRY...
 +
BLEND_MAP_MODIFIERS:
 +
  blend_mode BLEND_MODE |
 +
  blend_gamma FLOAT
 +
BLEND_MODE:
 +
  0 | 1 | 2 | 3
 
PIGMENT_MAP_ENTRY:
 
PIGMENT_MAP_ENTRY:
 
   [ Value PIGMENT_BODY ]
 
   [ Value PIGMENT_BODY ]
 
</pre>
 
</pre>
<p>Where <em><code>Value</code></em> is a float value between 0.0 and 1.0 inclusive and each <em>PIGMENT_BODY</em> is anything which can be inside a <code>pigment{...}</code> statement. The <code>pigment</code> keyword and
+
 
<code>{}</code> braces need not be specified.</p>
+
<p>Where <em><code>Value</code></em> is a float value between 0.0 and 1.0 inclusive and each <em>PIGMENT_BODY</em> is anything which can be inside a <code>pigment{...}</code> statement. The <code>pigment</code> keyword and <code>{}</code> braces need not be specified.</p>
<p class="Note"><strong>Note:</strong> The <code>[]</code> brackets are part of the actual <em>PIGMENT_MAP_ENTRY</em>. They are not notational symbols denoting optional parts. The brackets surround each entry in the pigment map.</p>
+
 
<p>There may be from 2 to 256 entries in the map.</p>
+
<p>The possible values for <code>blend_mode</code> and their descriptions are as follows:</p>
<p>For example:</p>
+
<ul>
 +
  <li><strong>0:</strong> Color interpolation is performed in the working gamma space as defined by <code>assumed_gamma</code> (default)</li>
 +
  <li><strong>1:</strong> Color interpolation is performed in the linear color space</li>
 +
  <li><strong>2:</strong> Color interpolation is performed in the gamma space defined by <code>blend_gamma</code> (default is 2.5)</li>
 +
  <li><strong>3:</strong> Chromatic interpolation is performed in the linear space while brightness interpolation is performed in the gamma space defined by <code>blend_gamma</code></li>
 +
</ul>
 +
 
 +
<p class="Note"><strong>Note:</strong> The <code>[]</code> brackets that are part of the actual <em>PIGMENT_MAP_ENTRY</em> should not confused with the symbols denoting optional syntax.</p>
 +
 
 +
<p>In <em>previous</em> versions there <em>had</em> to be from 2 to 256 entries in the map. A {{Change}} in version 3.8 has removed the upper restriction.</p>
 +
 
 +
<p>Here's a simple example:</p>
 +
 
 
<pre>
 
<pre>
 
sphere {
 
sphere {
Line 31: Line 52:
 
   }
 
   }
 
</pre>
 
</pre>
 +
 
<p>When the <code>gradient x</code> function returns values from 0.0 to 0.3 the scaled wood pigment is used. From 0.3 to 0.6 the pigment identifier Jade is used. From 0.6 up to 0.9 a blend of Jade and a turbulent marble is used. From 0.9 on up only the turbulent marble is used.</p>
 
<p>When the <code>gradient x</code> function returns values from 0.0 to 0.3 the scaled wood pigment is used. From 0.3 to 0.6 the pigment identifier Jade is used. From 0.6 up to 0.9 a blend of Jade and a turbulent marble is used. From 0.9 on up only the turbulent marble is used.</p>
 +
 
<p>Pigment maps may be nested to any level of complexity you desire. The pigments in a map may have color maps or pigment maps or any type of pigment you want. Any entry of a pigment map may be a solid color however if all entries are solid colors you should use a <code>color_map</code> which will render slightly faster.</p>
 
<p>Pigment maps may be nested to any level of complexity you desire. The pigments in a map may have color maps or pigment maps or any type of pigment you want. Any entry of a pigment map may be a solid color however if all entries are solid colors you should use a <code>color_map</code> which will render slightly faster.</p>
<p>Entire pigments may also be used with the block patterns such as <code>checker</code>, <code>hexagon</code> and <code>brick</code>. For example:</p>
+
 
 +
<p>Entire pigments may also be used with the block patterns <code>checker</code>, <code>hexagon</code> and <code>brick</code> as shown below:</p>
 +
 
 
<pre>
 
<pre>
 
pigment {
 
pigment {
Line 41: Line 66:
 
     }
 
     }
 
</pre>
 
</pre>
 +
 
<p class="Note"><strong>Note:</strong> In the case of block patterns the <code>pigment</code> wrapping is required around the pigment information.</p>
 
<p class="Note"><strong>Note:</strong> In the case of block patterns the <code>pigment</code> wrapping is required around the pigment information.</p>
<p>A pigment map is also used with the <code>average</code> pigment type. See
+
 
[[Reference:Average Pattern|:Average|Average]] for details.</p>
+
<p>A pigment map is also used with the <code>average</code> pigment type. See [[Reference:Average Pattern|:Average|Average]] for details.</p>
 +
 
 
<p>You may not use <code>pigment_map</code> or individual pigments with an <code>image_map</code>. See section <!--<linkto "Texture Maps">Texture Maps</linkto>--->[[Reference:Patterned Textures#Texture Maps|Texture Maps]] for an alternative way to do this.</p>
 
<p>You may not use <code>pigment_map</code> or individual pigments with an <code>image_map</code>. See section <!--<linkto "Texture Maps">Texture Maps</linkto>--->[[Reference:Patterned Textures#Texture Maps|Texture Maps]] for an alternative way to do this.</p>
 +
 
<p>You may declare and use pigment map identifiers but the only way to declare a pigment block pattern list is to declare a pigment identifier for the entire pigment.</p>
 
<p>You may declare and use pigment map identifiers but the only way to declare a pigment block pattern list is to declare a pigment identifier for the entire pigment.</p>
 +
 +
<p>See also: [[Reference:Color Map|Color Maps]].</p>

Latest revision as of 10:44, 24 July 2017

In addition to specifying blended colors with a color map you may create a blend of pigments using a pigment_map. The syntax for a pigment map is identical to a color map except you specify a pigment in each map entry and not a color. New in version 3.8 non-linear pigment map interpolation support has been added.

The syntax for pigment_map is as follows:

PIGMENT_MAP:
  pigment_map { PIGMENT_MAP_BODY }
PIGMENT_MAP_BODY:
  PIGMENT_MAP_IDENTIFIER |
  [BLEND_MAP_MODIFIERS...] PIGMENT_MAP_ENTRY...
BLEND_MAP_MODIFIERS:
  blend_mode BLEND_MODE |
  blend_gamma FLOAT
BLEND_MODE:
  0 | 1 | 2 | 3
PIGMENT_MAP_ENTRY:
  [ Value PIGMENT_BODY ]

Where Value is a float value between 0.0 and 1.0 inclusive and each PIGMENT_BODY is anything which can be inside a pigment{...} statement. The pigment keyword and {} braces need not be specified.

The possible values for blend_mode and their descriptions are as follows:

  • 0: Color interpolation is performed in the working gamma space as defined by assumed_gamma (default)
  • 1: Color interpolation is performed in the linear color space
  • 2: Color interpolation is performed in the gamma space defined by blend_gamma (default is 2.5)
  • 3: Chromatic interpolation is performed in the linear space while brightness interpolation is performed in the gamma space defined by blend_gamma

Note: The [] brackets that are part of the actual PIGMENT_MAP_ENTRY should not confused with the symbols denoting optional syntax.

In previous versions there had to be from 2 to 256 entries in the map. A Change in version 3.8 has removed the upper restriction.

Here's a simple example:

sphere {
  <0,1,2>, 2
  pigment {
    gradient x       //this is the PATTERN_TYPE
    pigment_map {
      [0.3 wood scale 0.2]
      [0.3 Jade]     //this is a pigment identifier
      [0.6 Jade]
      [0.9 marble turbulence 1]
      }
    }
  }

When the gradient x function returns values from 0.0 to 0.3 the scaled wood pigment is used. From 0.3 to 0.6 the pigment identifier Jade is used. From 0.6 up to 0.9 a blend of Jade and a turbulent marble is used. From 0.9 on up only the turbulent marble is used.

Pigment maps may be nested to any level of complexity you desire. The pigments in a map may have color maps or pigment maps or any type of pigment you want. Any entry of a pigment map may be a solid color however if all entries are solid colors you should use a color_map which will render slightly faster.

Entire pigments may also be used with the block patterns checker, hexagon and brick as shown below:

pigment {
  checker
    pigment { Jade scale .8 }
    pigment { White_Marble scale .5 }
    }

Note: In the case of block patterns the pigment wrapping is required around the pigment information.

A pigment map is also used with the average pigment type. See Average for details.

You may not use pigment_map or individual pigments with an image_map. See section Texture Maps for an alternative way to do this.

You may declare and use pigment map identifiers but the only way to declare a pigment block pattern list is to declare a pigment identifier for the entire pigment.

See also: Color Maps.