Difference between revisions of "Reference:Pigment Map"

From POV-Wiki
Jump to navigation Jump to search
m (cleanup and blend mode / gamma additions)
m (corrections)
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
{{#indexentry:blend_gamma}}
 
{{#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. {{New}} in version 3.7.1 non-linear pigment map interpolation support has been added.</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>
Line 11: Line 11:
 
   pigment_map { PIGMENT_MAP_BODY }
 
   pigment_map { PIGMENT_MAP_BODY }
 
PIGMENT_MAP_BODY:
 
PIGMENT_MAP_BODY:
   PIGMENT_MAP_IDENTIFIER | [blend_mode [BLEND_MODE]] [blend_gamma [FLOAT]] | PIGMENT_MAP_ENTRY...
+
   PIGMENT_MAP_IDENTIFIER |
 +
  [BLEND_MAP_MODIFIERS...] PIGMENT_MAP_ENTRY...
 +
BLEND_MAP_MODIFIERS:
 +
  blend_mode BLEND_MODE |
 +
  blend_gamma FLOAT
 
BLEND_MODE:
 
BLEND_MODE:
   [0] | 1 | 2 | 3
+
   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>The possible values for <code>blend_mode</code> and their descriptions are as follows:</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 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>There may be from 2 to 256 entries in the map.</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 an example:</p>
+
<p>Here's a simple example:</p>
  
 
<pre>
 
<pre>
Line 63: Line 75:
 
<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>The possible values for <code>blend_mode</code> and their descriptions are as follows:</p>
+
<p>See also: [[Reference:Color Map|Color Maps]].</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>[[Reference:Color_Map|Color Maps]] also support the {{New}} non-linear interpolation scheme.</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.