POV-Ray : Documentation : 2.5.11.16 Function Image
  POV-Ray 3.6 Documentation Online View  
2.5.11.15 Function as pattern   2.5.11.17 Gradient

2.5.11.16 Function Image

Syntax :function Width, Height { FUNCTION_BODY }

Not a real pattern, but listed here for convenience. This keyword defines a new 'internal' bitmap image type. The pixels of the image are derived from the Function_Body, with Function_Body either being a regular function, a pattern function or a pigment function. In case of a pigment function the output image will be in color, in case of a pattern or regular function the output image will be grayscale. All variants of grayscale pigment functions are available using the regular function syntax, too. In either case the image will use 16 bit per component

Note: functions are evaluated on the x-y plane. This is different from the pattern image type for the reason that it makes using uv functions easier.

Width and Height specify the resolution of the resulting 'internal' bitmap image. The image is taken from the square region <0,0,0>, <1,1,0>

The function statement can be used wherever an image specifier like tga or png may be used. Some uses include creating heightfields from procedural textures or wrapping a slice of a 3d texture or function around a cylinder or extrude it along an axis.

Examples:

   plane { 
      y, -1 
      pigment { 
         image_map { 
            function 10,10 { 
               pigment { checker 1,0 scale .5  }
            }
         }
         rotate x*90
      } 
   }
   height_field {
      function 200,200 {
         pattern {
            bozo
         }
      }
      translate -0.5
      scale 10
      pigment {rgb 1}
   }

Note: that for height fields and other situations where color is not needed it is easier to use function n,n {pattern{...}} than function n,n {pigment{...}}. The pattern functions are returning a scalar, not a color vector, thus a pattern is grayscale.

2.5.11.15 Function as pattern   2.5.11.17 Gradient


Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.