Reference:Image Pattern

From POV-Wiki
Revision as of 11:15, 8 January 2018 by Jholsenback (talk | contribs) (remove multi-link markup)
Jump to navigation Jump to search

Instead of placing the color of the image on the object using an image_map, the image_pattern specifies an entire texture item (color, pigment, normal or texture) based on the gray value at that point.

This gray value is evaluated against a list and the corresponding item is then used for the texture at that particular point. For values between listed items, an averaged texture is calculated.

It takes a standard image specification with the option, use_alpha, which works similar to use_color or use_index.

Note: See the section Using the Alpha Channel for some important information regarding the use of image_pattern.

Syntax:

PIGMENT:
  pigment {
    IMAGE_PATTERN
    color_map { COLOR_MAP_BODY } | colour_map { COLOR_MAP_BODY } | pigment_map { PIGMENT_MAP_BODY }
    }
NORMAL:
  normal {
    IMAGE_PATTERN [Bump_Size]
    normal_map { NORMAL_MAP_BODY }
    }
TEXTURE:
  texture {
    IMAGE_PATTERN
    texture_map { TEXTURE_MAP_BODY }
    }

IMAGE_PATTERN:
  image_pattern {
    BITMAP_TYPE "bitmap.ext" [gamma GAMMA] [premultiplied BOOL]
    [IMAGE_MAP_MODS...]
    }
BITMAP_TYPE:
  exr | gif | hdr | iff | jpeg | pgm | png | ppm | sys | tga | tiff
GAMMA:
  Float_Value | srgb | bt709 | bt2020
IMAGE_MAP_MODS:
  map_type Type | once | interpolate Type | use_alpha
ITEM_MAP_BODY:
  ITEM_MAP_IDENTIFIER | ITEM_MAP_ENTRY...
ITEM_MAP_ENTRY:
  [ GRAY_VALUE  ITEM_MAP_ENTRY... ]

It is also useful for creating texture masks as in the following:

texture {
  image_pattern { tga "image.tga" use_alpha }
  texture_map {
    [0 Mytex]
    [1 pigment { transmit 1 }]
    }
  }

Note: This pattern uses an image to get the gray values. If you want exactly the same possibilities but need to get gray values from a pigment, you can use the pigment_pattern.

While POV-Ray will normally interpret the image pattern input file as a container of linear data irregardless of file type, this can be overridden for any individual image pattern input file by specifying gamma GAMMA immediately after the file name. For example:

image_pattern {
  jpeg "foobar.jpg" gamma 1.8
  }

This will cause POV-Ray to perform gamma adjustment or decoding on the input file data before building the image pattern. Alternatively to a numerical value, srgb may be specified to denote that the file format is pre-corrected or encoded using the sRGB transfer function instead of a power-law gamma function. New in version 3.8, other valid special values are bt709 and bt2020, denoting that the file is encoded or pre-corrected using the ITU-R BT.709 or BT.2020 transfer function, respectively. See section Gamma Handling for more details.


RefImgImagePigment.png
RefImgImageNormal.png

image pattern used as pigment and normal respectively