--- image_indexed_textures Uses an image to paint a texture list onto objects via set mappings Must be specified within a texture{} block. The features is part of a texture definition as used. Options: -------- The following settings are available and must be within the image_indexed_textures{} block. ----- file_type - Seldom needed in modern POV-Ray releases. The types are: exr | gif | hdr | iff | jpeg | pgm | png | ppm | tga | tiff Note. The supported set depends on the build configuration and compile. filename - Name of the input image file as a string. Where the file extension is specified (ie myMap.png), it is used as the file type. If just "myMap" used, the current output file type as defaulted or specified is assumed to be the input file type. gamma - Gamma encoding used for image file. The image_indexed_textures{} feature assumes no gamma correction (gamma 1.0), but one can override this treatment. Incorrect application can scramble the indexing into texture list. premultiplied - Specify the input image alpha handling. The image_indexed_textures{} feature assumes false, but if there is an alpha channel with the input image one can override - again this can scramble the indexing into texture list. ----- or ----- function , { Fn00(x,y,z) } Specify resolution and function to define an internal image using a function. Both grey and color images may be defined in this fashion. This a possible 'step one' in using POV-Ray as an image editor for blurring images etc. With image_indexed_textures{} feature where the generated internal image is a full rgbft float format rather than grey only the red channel value used to index in the texture list. Note. Images with respect to the functions 'y' value are upside down to match the typical internal image representations for images. ----- Input Image mapping modifiers ----------------------------- ii_interpolate - 0 = No interpolation. 2 = Bi-Linear 3 = Bi-Cubic 4 = Normalized distance. The common image_indexed_textures{} will not use interpolation. It can be used for interesting patterns generations and effects. Note that Interpolation is applied to index values of index / palette images too - which is of iffy value typically. ii_repeat <2D vector> - How often to repeat in 1x1 unit square. ii_offset <2D vector> - Offset image from lower left. ii_once - If used, the input image is not repeated inside or outside the 0-1, x,y unit square. Values outside the image are returned as 0. ii_map_type - 0 = Planar map onto the x-y plane, infinite in z. 1 = Spherical map. Input image usually 2 x 1. 2 = Cylindrical map. Input image usually 2 x 1. 3 = Torus map. Input image usually 2 x 1. 7 = Angular map. Light probe projection popularized by Paul Devebec and coming from MegaPOV. ----- Spatial modifiers supported --------------------------- There is special handling for the spatial modifiers given they cannot be used everywhere one might expect within an image_indexed_textures{} specification. What works generally is applied in the outer texture { image_indexed_textures{} } context. For example: texture { image_indexed_textures{...} } The modifiers supported are: translate - rotate - scale - matrix - transform - no_bump_scale - warp{} - Note! This support is new to the yuqk fork. Defaults: --------- The defaults are: ----- file_type See above. If not specified, taken from current output file type. filename None. A string being specified for the file name indicates the intent is to read the image file indicated. gamma The default is 'gamma 1.0'. premultiplied false ----- or ----- function , { Fn00(x,y,z) } No defaults. Fully specify resolution and function to define an internal image using a function. ----- // ii_interpolate // Not specified. Same as 'ii_interpolate 0' ii_repeat <1,1> ii_offset <0,0> // ii_once // Image repeated accoriding to mapping type. ii_mape_type 0 Description: ------------ The feature uses an image mapped to in some standard way to map a list of textures to particular pixels. The mapping is done by using or deriving indexes into the texture list. Where the input images use a palette registry / index, those values are used more or less directly. Where the images used explicitly set RGBA channel values the index into the texture list is derived from the .red or .grey channel depending on the image input format. Before going too far with this feature one should be aware of yuqk's list_object{} which might be easier to use for smaller sets (lists) of textures. ... TODO Finish this documentation ... Re-worked the image_indexed_textures{} feature so it more reliably works with image formats supporting channel depths > 8 bits or channel values >1.0. - Texture list entry 0 is always the default background / unmapped region texture. Further, rather than wrap when palette registers/indexes exceed the number of textures in the list, yuqk maps these also to the 0 texture entry. - Adding support for color channel depths > 8 bits by specifying texture list of longer than 256 entries. (The 0.0..1.0 red channel multiplier becomes 65535.0 rather than always 255.0) - High dynamic range images, which often have .red or .grey values > 1.0 in typical use, can exploit this support by using the .red or .grey values directly as index values into the texture list. - Removed a dynamic_cast in render time image value access code significantly improving performance. - Additional parse time checks for valid map types, etc. - Added warp{} parsing support. - Rather than casting to map image float values to integers, yuqk now rounds using std::lround() which makes interpolations more useable. - Negative .red / grey channel values, which have never been handled properly, are now treated as positive values after rounding - so they map to some entry in the texture list. - (Move to issues section...) Fixed bugs in imageutil.cpp's InterpolateBicubic() and Interp() where the code by numerical noise was sometimes flipped into an index calculated mode. Reference: https://news.povray.org/povray.beta-test/thread/%3C6788ddd9%241%40news.povray.org%3E/ --- // Sample scene. 'yuqk image_indexed_textures.pov +w900 +h700 +p +a +mv3.8' global_settings { assumed_gamma 1 } #declare VarOrthoMult = 3.0/max(image_width/image_height,image_height/image_width); #declare Camera01z = camera { orthographic location <0,0,-2> direction z right VarOrthoMult*x*max(1,image_width/image_height) up VarOrthoMult*y*max(1,image_height/image_width) } #include "functions.inc" #declare ImgIdxTxtrs = texture { image_indexed_textures { // Official POV-Ray calls this material_map{} function 22 17 { pigment { user_defined { function { f_popnrm_rnoise(x,y,z,e *1e5,0)*0.1 }, function { 0 }, function { 0 }, function { 0 }, function { 0 } } //warp { it_amount 0.3 } // This use OK... } } // png "povmap.png" ii_map_type 0 ii_interpolate 4 // Acts on palette register / index entries too // which is of 'iffy' usefulness... // ii_offset 1/4 // ii_repeat 2 ii_once texture { pigment { rgb <0.05,0.05,0.05> } finish { emission 1 } } texture { pigment { rgb <1,0,0> } finish { emission 1 } } texture { pigment { rgb <0,1,0> } finish { emission 1 } } texture { pigment { rgb <0,0,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } texture { pigment { rgb <1,1,1> } finish { emission 1 } } // finish { emission 1 } // Illegal // scale <-1,1,1> // Illegal } // finish { emission 1 } // Illegal // scale <-1,1,1> // OK warp { repeat x flip x } // OK only in the yuqk fork warp { repeat y flip y } // OK only in the yuqk fork warp { it_amount 0.03 it_octaves 6 it_omega 0.77 it_lambda 4.4 it_scale 7.3 } // OK only in the yuqk fork } plane { -z 0 texture { ImgIdxTxtrs } } camera { Camera01z } Issues: ------- This feature has long been called material_map{} in POV-Ray. The addition of material{} identifier wrappers for texture{} and interior{} combinations made the material_map{} feature confusing due the name. Further, the feature in being old had not been updated to work with more recently supported image file formats or the warp{} feature in official POV-Ray releases. The yuqk fork state: -------------------- 'image_indexed_textures' was modified. Where useable: -------------- Only within Scene Description Language (SDL) during parsing. Type: ----- The pattern 'image_indexed_textures' is of a special type - average being the most commonly used. // SPDX-License-Identifier: CC-BY-SA-4.0