Difference between revisions of "Reference:Image Pattern"

From POV-Wiki
Jump to navigation Jump to search
m (Added one more srgb indexentry)
m (missed one)
 
(3 intermediate revisions by the same user not shown)
Line 37: Line 37:
 
IMAGE_PATTERN:
 
IMAGE_PATTERN:
 
   image_pattern {
 
   image_pattern {
     BITMAP_TYPE "bitmap.ext" [gamma GAMMA] [premultiplied BOOL]
+
     [BITMAP_TYPE] "filename" [gamma GAMMA] [premultiplied BOOL]
 
     [IMAGE_MAP_MODS...]
 
     [IMAGE_MAP_MODS...]
 
     }
 
     }
Line 63: Line 63:
 
</pre>
 
</pre>
  
<p class="Note"><strong>Note:</strong> 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 [[Reference:Pigment Map|:pigment_pattern|pigment_pattern]].</p>
+
<p class="Note"><strong>Note:</strong> 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 <code>[[Reference:Pigment Pattern|pigment_pattern]]</code>.</p>
 
<p>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 <code>gamma</code> GAMMA immediately after the file name. For example:</p>
 
<p>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 <code>gamma</code> GAMMA immediately after the file name. For example:</p>
 
<pre>
 
<pre>
Line 73: Line 73:
 
{{#indexentry:bt2020, keyword}}
 
{{#indexentry:bt2020, keyword}}
 
{{#indexentry:srgb, keyword}}
 
{{#indexentry:srgb, keyword}}
<p>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, <code>srgb</code> may be specified to denote that the file format is pre-corrected or encoded using the <em>sRGB transfer function</em> instead of a power-law gamma function. {{New}} in version 3.7.1, other valid special values are <code>bt709</code> and <code>bt2020</code>, denoting that the file is encoded or pre-corrected using the ITU-R BT.709 or BT.2020 transfer function, respectively. See section [[Documentation:Tutorial Section 3.3#Gamma Handling|Gamma Handling]] for more details.</p>
+
<p>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, <code>srgb</code> may be specified to denote that the file format is pre-corrected or encoded using the <em>sRGB transfer function</em> instead of a power-law gamma function. {{New}} in version 3.8, other valid special values are <code>bt709</code> and <code>bt2020</code>, denoting that the file is encoded or pre-corrected using the ITU-R BT.709 or BT.2020 transfer function, respectively. See section [[Documentation:Tutorial Section 3.3#Gamma Handling|Gamma Handling]] for more details.</p>
  
  

Latest revision as of 11:46, 6 February 2018

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] "filename" [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