Difference between revisions of "Reference:Pigment Map"

From POV-Wiki
Jump to navigation Jump to search
m (version changes)
m (clarification and clean up)
Line 9: Line 9:
 
<pre>
 
<pre>
 
PIGMENT_MAP:
 
PIGMENT_MAP:
   pigment_map { PIGMENT_MAP_BODY }
+
   pigment_map { [blend_mode [BLEND_MODE]] [blend_gamma [FLOAT]] | PIGMENT_MAP_BODY }
PIGMENT_MAP_BODY:
 
  PIGMENT_MAP_IDENTIFIER | [blend_mode [BLEND_MODE]] [blend_gamma [FLOAT]] | PIGMENT_MAP_ENTRY...
 
 
BLEND_MODE:
 
BLEND_MODE:
 
   [0] | 1 | 2 | 3
 
   [0] | 1 | 2 | 3
 +
PIGMENT_MAP_BODY:
 +
  PIGMENT_MAP_IDENTIFIER | PIGMENT_MAP_ENTRY...
 
PIGMENT_MAP_ENTRY:
 
PIGMENT_MAP_ENTRY:
 
   [Value PIGMENT_BODY]
 
   [Value PIGMENT_BODY]
Line 19: Line 19:
  
 
<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>
Line 24: Line 32:
 
<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>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 71:
 
<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>
 

Revision as of 14:13, 23 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 { [blend_mode [BLEND_MODE]] [blend_gamma [FLOAT]] | PIGMENT_MAP_BODY }
BLEND_MODE:
  [0] | 1 | 2 | 3
PIGMENT_MAP_BODY:
  PIGMENT_MAP_IDENTIFIER | PIGMENT_MAP_ENTRY...
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.