Reference:Pigment Map

From POV-Wiki
Jump to navigation Jump to search

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.