Difference between revisions of "Reference:Image Pattern"

From POV-Wiki
Jump to navigation Jump to search
m (3.7.1 updates)
Line 13: Line 13:
 
{{#indexentry:pattern, use_alpha}}  
 
{{#indexentry:pattern, use_alpha}}  
 
{{#indexentry:use_alpha}}
 
{{#indexentry:use_alpha}}
<p>Instead of placing the color of the image on the object like an <code>image_map</code>, an <code>image_pattern</code> specifies an entire texture item (color, pigment, normal or texture) based on the gray value at that point.</p>
+
<p>Instead of placing the color of the image on the object using an <code>image_map</code>, the <code>image_pattern</code> specifies an entire texture item (color, pigment, normal or texture) based on the gray value at that point.</p>
<p>This gray-value is checked 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.</p>
+
<p>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.</p>
<p>It takes a standard image specification and has one option, <code>use_alpha</code>, which works similar to <code>use_color</code> or <code>use_index</code>.</p>
+
<p>It takes a standard image specification with the option, <code>use_alpha</code>, which works similar to <code>use_color</code> or <code>use_index</code>.</p>
 
<p class="Note"><strong>Note:</strong> See the section [[Reference:Image Map#Using the Alpha Channel|Using the Alpha Channel]] for some important information regarding the use of <code>image_pattern</code>.</p>
 
<p class="Note"><strong>Note:</strong> See the section [[Reference:Image Map#Using the Alpha Channel|Using the Alpha Channel]] for some important information regarding the use of <code>image_pattern</code>.</p>
 
<p>Syntax:</p>
 
<p>Syntax:</p>
Line 22: Line 22:
 
   pigment {
 
   pigment {
 
     IMAGE_PATTERN
 
     IMAGE_PATTERN
     color_map { COLOR_MAP_BODY } |
+
     color_map { COLOR_MAP_BODY } | colour_map { COLOR_MAP_BODY } | pigment_map { PIGMENT_MAP_BODY }
    colour_map { COLOR_MAP_BODY } |  
 
    pigment_map { PIGMENT_MAP_BODY }
 
 
     }
 
     }
 
 
NORMAL:
 
NORMAL:
 
   normal {
 
   normal {
Line 32: Line 29:
 
     normal_map { NORMAL_MAP_BODY }
 
     normal_map { NORMAL_MAP_BODY }
 
     }
 
     }
 
 
TEXTURE:
 
TEXTURE:
 
   texture {
 
   texture {
Line 44: Line 40:
 
     [IMAGE_MAP_MODS...]
 
     [IMAGE_MAP_MODS...]
 
     }
 
     }
 
+
BITMAP_TYPE:
IMAGE_MAP_MOD:
+
  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
 
   map_type Type | once | interpolate Type | use_alpha
  ITEM_MAP_BODY:
+
ITEM_MAP_BODY:
 
   ITEM_MAP_IDENTIFIER | ITEM_MAP_ENTRY...
 
   ITEM_MAP_IDENTIFIER | ITEM_MAP_ENTRY...
  ITEM_MAP_ENTRY:
+
ITEM_MAP_ENTRY:
 
   [ GRAY_VALUE  ITEM_MAP_ENTRY... ]
 
   [ GRAY_VALUE  ITEM_MAP_ENTRY... ]
 
</pre>
 
</pre>
  
<p>It is also useful for creating texture <em>masks</em>, like the following:</p>
+
<p>It is also useful for creating texture <em>masks</em> as in the following:</p>
 
<pre>
 
<pre>
 
texture {
 
texture {
 
   image_pattern { tga &quot;image.tga&quot; use_alpha }
 
   image_pattern { tga &quot;image.tga&quot; use_alpha }
 
   texture_map {
 
   texture_map {
     [0 Mytex ]
+
     [0 Mytex]
     [1 pigment { transmit 1 } ]
+
     [1 pigment { transmit 1 }]
 
     }
 
     }
 
   }
 
   }
 
</pre>
 
</pre>
  
<p class="Note"><strong>Note:</strong> This pattern uses an image to get the gray values from. If you want exactly the
+
<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>
same possibilities but need to get gray values from a pigment, you can use the [[Reference:Pigment Map|:pigment_pattern|pigment_pattern]].</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>
 
image_pattern {
 
image_pattern {
Line 73: Line 70:
 
   }
 
   }
 
</pre>
 
</pre>
<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. See section [[Documentation:Tutorial Section 3.3#Gamma Handling|Gamma Handling]] for more information on gamma.</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.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>
  
  

Revision as of 09:02, 13 October 2016

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.7.1, 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