### 3.5.12 Pattern Modifiers

Pattern modifiers are statements or parameters which modify how a pattern is evaluated or tells what to do with the pattern. The complete syntax is:

    PATTERN_MODIFIER:
        BLEND_MAP_MODIFIER | AGATE_MODIFIER | DENSITY_FILE_MODIFIER |
        QUILTED_MODIFIER | BRICK_MODIFIER | SLOPE_MODIFIER |
        noise_generator Number| turbulence <Amount> |
        octaves Count | omega Amount | lambda Amount |
        warp { [WARP_ITEMS...] } | TRANSFORMATION
    BLEND_MAP_MODIFIER:
        frequency Amount | phase Amount | ramp_wave | triangle_wave |
        sine_wave | scallop_wave | cubic_wave | poly_wave [Exponent]
    AGATE_MODIFIER:
        agate_turb Value
    BRICK_MODIFIER:
        brick_size Size | mortar Size
    DENSITY_FILE_MODIFIER:
        interpolate Type
    SLOPE_MODIFIERS:
    	<Altitude>
    	<Lo_slope,Hi_slope>
        <Lo_alt,	Hi_alt>
    QUILTED_MODIFIER:
        control0 Value | control1 Value
    PIGMENT_MODIFIER:
        PATTERN_MODIFIER | COLOR_LIST | PIGMENT_LIST |
        color_map { COLOR_MAP_BODY } | colour_map { COLOR_MAP_BODY } |
        pigment_map{ PIGMENT_MAP_BODY } | quick_color COLOR |
        quick_colour COLOR
    COLOR NORMAL_MODIFIER:
        PATTERN_MODIFIER | NORMAL_LIST |
        normal_map { NORMAL_MAP_BODY } | slope_map{ SLOPE_MAP_BODY } |
        bump_size Amount
    TEXTURE_PATTERN_MODIFIER:
        PATTERN_MODIFIER | TEXTURE_LIST |
        texture_map{ TEXTURE_MAP_BODY }
    DENSITY_MODIFIER:
        PATTERN_MODIFIER | DENSITY_LIST | COLOR_LIST |
        color_map { COLOR_MAP_BODY } | colour_map { COLOR_MAP_BODY } |
        density_map { DENSITY_MAP_BODY }

Default values for pattern modifiers:

    dist_exp        : 0
    falloff         : 2.0
    frequency       : 1.0
    lambda          : 2.0
    major_radius    : 1
    map_type        : 0
    noise_generator : 2
    octaves         : 6
    omega           : 0.5
    orientation     : <0,0,1>
    phase           : 0.0
    poly_wave       : 1.0
    strength        : 1.0
    turbulence      : <0,0,0>

The modifiers PIGMENT_LIST, `quick_color`, and `pigment_map` apply only to pigments. See section "Pigment" for details on these pigment-specific pattern modifiers.

The modifiers COLOR_LIST and `color_map` apply only to pigments and densities. See sections "Pigment" and "Density" for details on these pigment-specific pattern modifiers.

The modifiers NORMAL_LIST, `bump_size`, `slope_map` and `normal_map` apply only to normals. See section "Normal" for details on these normal-specific pattern modifiers.

The TEXTURE_LIST and `texture_map` modifiers can only be used with patterned textures. See section "Texture Maps" for details.

The DENSITY_LIST and `density_map` modifiers only work with `media{density{..}}` statements. See "Density" for details.

The `agate_turb` modifier can only be used with the `agate` pattern. See "Agate" for details.

The `brick_size` and `mortar` modifiers can only be used with the `brick` pattern. See "Brick" for details.

The `control0` and `control1` modifiers can only be used with the `quilted` pattern. See "Quilted" for details.

The `interpolate` modifier can only be used with the `density_file` pattern. See "Density_File" for details.

The general purpose pattern modifiers in the following sections can be used with `pigment`, `normal`, `texture`, or `density` patterns.

#### 3.5.12.1 Transforming Patterns

The most common pattern modifiers are the transformation modifiers `translate`, `rotate`, `scale`, `transform`, and `matrix`. For details on these commands see section "Transformations".

These modifiers may be placed inside pigment, normal, texture, and density statements to change the position, size and orientation of the patterns.

Transformations are performed in the order in which you specify them. However in general the order of transformations relative to other pattern modifiers such as `turbulence`, `color_map` and other maps is not important. For example scaling before or after turbulence makes no difference. The turbulence is done first, then the scaling regardless of which is specified first. However the order in which transformations are performed relative to `warp` statements is important. See "Warps" for details.

#### 3.5.12.2 Frequency and Phase

The `frequency` and `phase` modifiers act as a type of scale and translate modifiers for various blend maps. They only have effect when blend maps are used. Blend maps are `color_map`, `pigment_map`, `normal_map`, `slope_map`, `density_map`, and `texture_map`. This discussion uses a color map as an example but the same principles apply to the other blend map types.

The `frequency` keyword adjusts the number of times that a color map repeats over one cycle of a pattern. For example `gradient` covers color map values 0 to 1 over the range from x=0 to x=1. By adding `frequency 2.0` the color map repeats twice over that same range. The same effect can be achieved using `scale 0.5*x` so the frequency keyword is not that useful for patterns like gradient.

However the radial pattern wraps the color map around the +y-axis once. If you wanted two copies of the map (or 3 or 10 or 100) you would have to build a bigger map. Adding `frequency 2.0` causes the color map to be used twice per revolution. Try this:

      pigment {
        radial
        color_map{[0.5 color Red][0.5 color White]}
        frequency 6
      }

The result is six sets of red and white radial stripes evenly spaced around the object.

The float after `frequency` can be any value. Values greater than 1.0 causes more than one copy of the map to be used. Values from 0.0 to 1.0 cause a fraction of the map to be used. Negative values reverses the map.

The `phase` value causes the map entries to be shifted so that the map starts and ends at a different place. In the example above if you render successive frames at `phase 0` then `phase 0.1`, `phase 0.2`, etc. you could create an animation that rotates the stripes. The same effect can be easily achieved by rotating the `radial` pigment using `rotate y*Angle` but there are other uses where phase can be handy.

Sometimes you create a great looking gradient or wood color map but you want the grain slightly adjusted in or out. You could re-order the color map entries but that is a pain. A phase adjustment will shift everything but keep the same scale. Try animating a `mandel` pigment for a color palette rotation effect.

These values work by applying the following formula

New_Value = fmod ( Old_Value * Frequency + Phase, 1.0 ).

The `frequency` and `phase` modifiers have no effect on block patterns `checker`, `brick`, and `hexagon` nor do they effect `image_map`, `bump_map` or `material_map`. They also have no effect in normal statements when used with `bumps`, `dents`, `quilted` or `wrinkles` because these normal patterns cannot use `normal_map` or `slope_map`.

They can be used with normal patterns `ripples` and `waves` even though these two patterns cannot use `normal_map` or `slope_map` either. When used with `ripples` or `waves`, `frequency` adjusts the space between features and `phase` can be adjusted from 0.0 to 1.0 to cause the ripples or waves to move relative to their center for animating the features.

#### 3.5.12.3 Waveforms

POV-Ray allows you to apply various wave forms to the pattern function before applying it to a blend map. Blend maps are `color_map`, `pigment_map`, `normal_map`, `slope_map`, `density_map`, and `texture_map`.

Most of the patterns which use a blend map, use the entries in the map in order from 0.0 to 1.0. The effect can most easily be seen when these patterns are used as normal patterns with no maps. Patterns such as `gradient` or `onion` generate a groove or slot that looks like a ramp that drops off sharply. This is called a `ramp_wave` wave type and it is the default wave type for most patterns. However the `wood` and `marble` patterns use the map from 0.0 to 1.0 and then reverses it and runs it from 1.0 to 0.0. The result is a wave form which slopes upwards to a peak, then slopes down again in a `triangle_wave`. In earlier versions of POV-Ray there was no way to change the wave types. You could simulate a triangle wave on a ramp wave pattern by duplicating the map entries in reverse, however there was no way to use a ramp wave on wood or marble.

Now any pattern that takes a map can have the default wave type overridden. For example:

      pigment { wood color_map { MyMap } ramp_wave }

Also available are `sine_wave`, `scallop_wave`, `cubic_wave` and `poly_wave` types. These types are of most use in normal patterns as a type of built-in slope map. The `sine_wave` takes the zig-zag of a ramp wave and turns it into a gentle rolling wave with smooth transitions. The `scallop_wave` uses the absolute value of the sine wave which looks like corduroy when scaled small or like a stack of cylinders when scaled larger. The `cubic_wave` is a gentle cubic curve from 0.0 to 1.0 with zero slope at the start and end. The `poly_wave` is an exponential function. It is followed by an optional float value which specifies exponent. For example `poly_wave 2` starts low and climbs rapidly at the end while `poly_wave 0.5` climbs rapidly at first and levels off at the end. If no float value is specified, the default is 1.0 which produces a linear function identical to `ramp_wave`.

Although any of these wave types can be used for pigments, normals, textures, or density the effect of many of the wave types are not as noticeable on pigments, textures, or density as they are for normals.

Wave type modifiers have no effect on block patterns `checker`, `brick`, `object` and `hexagon` nor do they effect `image_map`, `bump_map` or `material_map`. They also have no effect in normal statements when used with `bumps`, `dents`, `quilted`, `ripples`, `waves`, or `wrinkles` because these normal patterns cannot use `normal_map` or `slope_map`.

#### 3.5.12.4 Noise Generators

There are three noise generators implemented. Changing the `noise_generator` will change the appearance of noise based patterns, like bozo and granite.

- `noise_generator 1` the noise that was used in POV_Ray 3.1
- `noise_generator 2` 'range corrected' version of the old noise, it does not show the plateaus seen with `noise_generator 1`
- `noise_generator 3` generates Perlin noise

The default is `noise_generator 2`

Note: The noise_generator can also be set in `global_settings`

#### 3.5.12.5 Turbulence

The `turbulence` pattern modifier is still supported for compatibility issues, but it is better nowadays to use the `warp {turbulence}` feature, which does not have turbulence's limitation in transformation order (turbulence is always applied first, before any scale, translate or rotate, whatever the order you specify). For a detailed discussion see 'Turbulence versus Turbulence Warp'

The old-style turbulence is handled slightly differently when used with the agate, marble, spiral1, spiral2, and wood textures.

#### 3.5.12.6 Warps

The `warp` statement is a pattern modifier that is similar to turbulence. Turbulence works by taking the pattern evaluation point and pushing it about in a series of random steps. However warps push the point in very well-defined, non-random, geometric ways. The `warp` statement also overcomes some limitations of traditional turbulence and transformations by giving the user more control over the order in which turbulence, transformation and warp modifiers are applied to the pattern.

Currently there are seven types of warps but the syntax was designed to allow future expansion. The turbulence warp provides an alternative way to specify turbulence. The others modify the pattern in geometric ways.

The syntax for using a `warp` statement is:

    WARP:
        warp { WARP_ITEM }
    WARP_ITEM:
        repeat <Direction> [REPEAT_ITEMS...] |
        black_hole <Location>, Radius [BLACK_HOLE_ITEMS...] |
        turbulence <Amount> [TURB_ITEMS...]
        cylindrical  [ orientation VECTOR | dist_exp FLOAT ]
        spherical  [ orientation VECTOR | dist_exp FLOAT ]
        toroidal  [ orientation VECTOR | dist_exp FLOAT |
                    major_radius FLOAT ]
        planar [ VECTOR , FLOAT ]
    REPEAT_ITEMS:
        offset <Amount> |
        flip <Axis>
    BLACK_HOLE_ITEMS:
        strength Strength | falloff Amount | inverse |
        repeat <Repeat> | turbulence <Amount>
    TURB_ITEMS:
        octaves Count | omega Amount | lambda Amount

You may have as many separate warp statements as you like in each pattern. The placement of warp statements relative to other modifiers such as `color_map` or `turbulence` is not important. However placement of warp statements relative to each other and to transformations is significant. Multiple warps and transformations are evaluated in the order in which you specify them. For example if you translate, then warp or warp, then translate, the results can be different.

##### 3.5.12.6.1 Black Hole Warp

A `black_hole` warp is so named because of its similarity to real black holes. Just like the real thing, you cannot actually see a black hole. The only way to detect its presence is by the effect it has on things that surround it.

Take, for example, a wood grain. Using POV-Ray's normal turbulence and other texture modifier functions, you can get a nice, random appearance to the grain. But in its randomness it is regular - it is regularly random! Adding a black hole allows you to create a localized disturbance in a wood grain in either one or multiple locations. The black hole can have the effect of either sucking the surrounding texture into itself (like the real thing) or pushing it away. In the latter case, applied to a wood grain, it would look to the viewer as if there were a knothole in the wood. In this text we use a wood grain regularly as an example, because it is ideally suitable to explaining black holes. However, black holes may in fact be used with any texture or pattern. The effect that the black hole has on the texture can be specified. By default, it sucks with the strength calculated exponentially (inverse-square). You can change this if you like.

Black holes may be used anywhere a warp is permitted. The syntax is:

    BLACK_HOLE_WARP:
        warp
        {
            black_hole <Location>, Radius
            [BLACK_HOLE_ITEMS...]
        }
    BLACK_HOLE_ITEMS:
        strength Strength | falloff Amount | inverse | type Type |
        repeat <Repeat> | turbulence <Amount>

The minimal requirement is the `black_hole` keyword followed by a vector `<Location>` followed by a comma and a float `Radius`. Black holes effect all points within the spherical region around the location and within the radius. This is optionally followed by any number of other keywords which control how the texture is warped.

The `falloff` keyword may be used with a float value to specify the power by which the effect of the black hole falls off. The default is two. The force of the black hole at any given point, before applying the `strength` modifier, is as follows.

First, convert the distance from the point to the center to a proportion (0 to 1) that the point is from the edge of the black hole. A point on the perimeter of the black hole will be 0.0; a point at the center will be 1.0; a point exactly halfway will be 0.5, and so forth. Mentally you can consider this to be a closeness factor. A closeness of 1.0 is as close as you can get to the center (i.e. at the center), a closeness of 0.0 is as far away as you can get from the center and still be inside the black hole and a closeness of 0.5 means the point is exactly halfway between the two.

Call this value c. Raise c to the power specified in `falloff`. By default Falloff is 2, so this is c^2 or c squared. The resulting value is the force of the black hole at that exact location and is used, after applying the `strength` scaling factor as described below, to determine how much the point is perturbed in space. For example, if c is 0.5 the force is 0.5^2 or 0.25. If c is 0.25 the force is 0.125. But if c is exactly 1.0 the force is 1.0. Recall that as c gets smaller the point is farther from the center of the black hole. Using the default power of 2, you can see that as c reduces, the force reduces exponentially in an inverse-square relationship. Put in plain English, it means that the force is much stronger (by a power of two) towards the center than it is at the outside.

By increasing `falloff`, you can increase the magnitude of the falloff. A large value will mean points towards the perimeter will hardly be affected at all and points towards the center will be affected strongly. A value of 1.0 for `falloff` will mean that the effect is linear. A point that is exactly halfway to the center of the black hole will be affected by a force of exactly 0.5. A value of `falloff` of less than one but greater than zero means that as you get closer to the outside, the force increases rather than decreases. This can have some uses but there is a side effect. Recall that the effect of a black hole ceases outside its perimeter. This means that points just within the perimeter will be affected strongly and those just outside not at all. This would lead to a visible border, shaped as a sphere. A value for `falloff` of 0 would mean that the force would be 1.0 for all points within the black hole, since any number larger 0 raised to the power of 0 is 1.0.

The `strength` keyword may be specified with a float value to give you a bit more control over how much a point is perturbed by the black hole. Basically, the force of the black hole (as determined above) is multiplied by the value of `strength`, which defaults to 1.0. If you set strength to 0.5, for example, all points within the black hole will be moved by only half as much as they would have been. If you set it to 2.0 they will be moved twice as much.

There is a rider to the latter example, though - the movement is clipped to a maximum of the original distance from the center. That is to say, a point that is 0.75 units from the center may only be moved by a maximum of 0.75 units either towards the center or away from it, regardless of the value of `strength`. The result of this clipping is that you will have an exclusion area near the center of the black hole where all points whose final force value exceeded or equaled 1.0 were moved by a fixed amount.

If the `inverse` keyword is specified then the points pushed away from the center instead of being pulled in.

The `repeat` keyword followed by a vector, allows you to simulate the effect of many black holes without having to explicitly declare them. Repeat is a vector that tells POV-Ray to use this black hole at multiple locations. Using `repeat` logically divides your scene up into cubes, the first being located at <0,0,0> and going to `<Repeat>`. Suppose your repeat vector was <1,5,2>. The first cube would be from <0,0,0> to < 1,5,2>. This cube repeats, so there would be one at < -1,-5,-2>, <1,5,2>, <2,10,4> and so forth in all directions, ad infinitum.

When you use `repeat`, the center of the black hole does not specify an absolute location in your scene but an offset into each block. It is only possible to use positive offsets. Negative values will produce undefined results.

Suppose your center was <0.5,1,0.25> and the repeat vector is <2,2,2>. This gives us a block at < 0,0,0> and <2,2,2>, etc. The centers of the black hole's for these blocks would be <0,0,0> + < 0.5,1.0,0.25>, i. e. <0.5,1.0,0.25>, and < 2,2,2> + <0.5,1.0,0.25>, i. e. < 2,5,3.0,2.25>.

Due to the way repeats are calculated internally, there is a restriction on the values you specify for the repeat vector. Basically, each black hole must be totally enclosed within each block (or cube), with no part crossing into a neighboring one. This means that, for each of the x, y and z dimensions, the offset of the center may not be less than the radius, and the repeat value for that dimension must be >=the center plus the radius since any other values would allow the black hole to cross a boundary. Put another way, for each of x, y and z

Radius <= Offset or Center <= Repeat - Radius.

If the repeat vector in any dimension is too small to fit this criteria, it will be increased and a warning message issued. If the center is less than the radius it will also be moved but no message will be issued.

Note that none of the above should be read to mean that you cannot overlap black holes. You most certainly can and in fact this can produce some most useful effects. The restriction only applies to elements of the `same` black hole which is repeating. You can declare a second black hole that also repeats and its elements can quite happily overlap the first and causing the appropriate interactions. It is legal for the repeat value for any dimension to be 0, meaning that POV-Ray will not repeat the black hole in that direction.

The `turbulence` can only be used in a black hole with `repeat`. It allows an element of randomness to be inserted into the way the black holes repeat, to cause a more natural look. A good example would be an array of knotholes in wood - it would look rather artificial if each knothole were an exact distance from the previous.

The `turbulence` vector is a measurement that is added to each individual black hole in an array, after each axis of the vector is multiplied by a different random amount ranging from 0 to 1. The resulting actual position of the black hole's center for that particular repeat element is random (but consistent, so renders will be repeatable) and somewhere within the above coordinates. There is a rider on the use of turbulence, which basically is the same as that of the repeat vector. You cannot specify a value which would cause a black hole to potentially cross outside of its particular block.

In summary: For each of x, y and z the offset of the center must be >=radius and the value of the repeat must be >= center + radius + turbulence. The exception being that repeat may be 0 for any dimension, which means do not repeat in that direction.

Some examples are given by

      warp {
        black_hole <0, 0, 0>, 0.5
      }
      warp {
        black_hole <0.15, 0.125, 0>, 0.5
        falloff 7
        strength 1.0
        repeat <1.25, 1.25, 0>
        turbulence <0.25, 0.25, 0>
        inverse
      }
      warp {
        black_hole <0, 0, 0>, 1.0
        falloff 2
        strength 2
        inverse
      }

##### 3.5.12.6.2 Repeat Warp

The `repeat` warp causes a section of the pattern to be repeated over and over. It takes a slice out of the pattern and makes multiple copies of it side-by-side. The warp has many uses but was originally designed to make it easy to model wood veneer textures. Veneer is made by taking very thin slices from a log and placing them side-by-side on some other backing material. You see side-by-side nearly identical ring patterns but each will be a slice perhaps 1/32th of an inch deeper.

The syntax for a repeat warp is

    REPEAT_WARP:
        warp { repeat <Direction> [REPEAT_ITEMS...] }
    REPEAT_ITEMS:
        offset <Amount> | flip <Axis>

The `repeat` vector specifies the direction in which the pattern repeats and the width of the repeated area. This vector must lie entirely along an axis. In other words, two of its three components must be 0. For example

      pigment {
        wood
        warp { repeat 2*x }
      }

which means that from x=0 to x=2 you get whatever the pattern usually is. But from x=2 to x=4 you get the same thing exactly shifted two units over in the x-direction. To evaluate it you simply take the x-coordinate modulo 2. Unfortunately you get exact duplicates which is not very realistic. The optional `offset` vector tells how much to translate the pattern each time it repeats. For example

      pigment {
        wood
        warp {repeat x*2  offset z*0.05}
      }

means that we slice the first copy from x=0 to x=2 at z=0 but at x=2 to x=4 we offset to z=0.05. In the 4 to 6 interval we slice at z=0.10. At the n-th copy we slice at 0.05 n z. Thus each copy is slightly different. There are no restrictions on the offset vector.

Finally the `flip` vector causes the pattern to be flipped or mirrored every other copy of the pattern. The first copy of the pattern in the positive direction from the axis is not flipped. The next farther is, the next is not, etc. The flip vector is a three component x, y, z vector but each component is treated as a boolean value that tells if you should or should not flip along a given axis. For example

      pigment {
        wood
        warp {repeat 2*x  flip <1,1,0>}
      }

means that every other copy of the pattern will be mirrored about the x- and y- axis but not the z-axis. A non-zero value means flip and zero means do not flip about that axis. The magnitude of the values in the flip vector does not matter.

##### 3.5.12.6.3 Turbulence versus Turbulence Warp

The POV-Ray language contains an ambiguity and limitation on the way you specify `turbulence` and transformations such as `translate`, `rotate`, `scale`, `matrix`, and `transform` transforms. Usually the turbulence is done first. Then all translate, rotate, scale, matrix, and transform operations are always done after turbulence regardless of the order in which you specify them. For example this

     pigment {
       wood
       scale .5
       turbulence .2
     }

works exactly the same as

     pigment {
       wood
       turbulence .2
       scale .5
     }

The turbulence is always first. A better example of this limitation is with uneven turbulence and rotations.

      pigment {
        wood
        turbulence 0.5*y
        rotate z*60
      }
      // as compared to
      pigment {
       wood
       rotate z*60
       turbulence 0.5*y
      }

The results will be the same either way even though you would think it should look different.

We cannot change this basic behavior in POV-Ray now because lots of scenes would potentially render differently if suddenly the order transformation vs. turbulence mattered when in the past, it did not.

However, by specifying our turbulence inside warp statement you tell POV-Ray that the order in which turbulence, transformations and other warps are applied is significant. Here is an example of a turbulence warp.

      warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }

The significance is that this

     pigment {
       wood
       translate <1,2,3> rotate x*45 scale 2
       warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }
     }

produces different results than this...

     pigment {
       wood
       warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }
       translate <1,2,3> rotate x*45 scale 2
     }

You may specify turbulence without using a warp statement. However you cannot control the order in which they are evaluated unless you put them in a warp.

The evaluation rules are as follows:

1. First any turbulence not inside a warp statement is applied regardless of the order in which it appears relative to warps or transformations.
2. Next each warp statement, translate, rotate, scale or matrix one-by-one, is applied in the order the user specifies. If you want turbulence done in a specific order, you simply specify it inside a warp in the proper place.

##### 3.5.12.6.4 Turbulence Warp

Inside the `warp` statement, the keyword `turbulence` followed by a float or vector may be used to stir up any `pigment`, `normal` or `density`. A number of optional parameters may be used with turbulence to control how it is computed. The syntax is:

    TURBULENCE_ITEM:
        turbulence <Amount> | octaves Count |
        omega Amount | lambda Amount

Typical turbulence values range from the default 0.0, which is no turbulence, to 1.0 or more, which is very turbulent. If a vector is specified different amounts of turbulence are applied in the x-, y- and z-direction. For example

      turbulence <1.0, 0.6, 0.1>

has much turbulence in the x-direction, a moderate amount in the y-direction and a small amount in the z-direction.

Turbulence uses a random noise function called DNoise. This is similar to the noise used in the `bozo` pattern except that instead of giving a single value it gives a direction. You can think of it as the direction that the wind is blowing at that spot. Points close together generate almost the same value but points far apart are randomly different.

Turbulence uses DNoise to push a point around in several steps called `octaves`. We locate the point we want to evaluate, then push it around a bit using turbulence to get to a different point then look up the color or pattern of the new point.

It says in effect "Do not give me the color at this spot... take a few random steps in different directions and give me that color". Each step is typically half as long as the one before. For example:

The magnitude of these steps is controlled by the turbulence value. There are three additional parameters which control how turbulence is computed. They are `octaves`, `lambda` and `omega`. Each is optional. Each is followed by a single float value. Each has no effect when there is no turbulence.

###### Octaves

The `octaves` keyword may be followed by an integer value to control the number of steps of turbulence that are computed. Legal values range from 1 to <10. The default value of 6 is a fairly high value; you will not see much change by setting it to a higher value because the extra steps are too small. Float values are truncated to integer. Smaller numbers of octaves give a gentler, wavy turbulence and computes faster. Higher octaves create more jagged or fuzzy turbulence and takes longer to compute.

###### Lambda

The `lambda` parameter controls how statistically different the random move of an octave is compared to its previous octave. The default value is 2.0 which is quite random. Values close to lambda 1.0 will straighten out the randomness of the path in the diagram above. The zig-zag steps in the calculation are in nearly the same direction. Higher values can look more swirly under some circumstances.

###### Omega

The `omega` value controls how large each successive octave step is compared to the previous value. Each successive octave of turbulence is multiplied by the omega value. The default `omega 0.5` means that each octave is 1/2 the size of the previous one. Higher omega values mean that 2nd, 3rd, 4th and up octaves contribute more turbulence giving a sharper, crinkly look while smaller omegas give a fuzzy kind of turbulence that gets blurry in places.

##### 3.5.12.6.5 Mapping using warps

Syntax:

      CYLINDRICAL_WARP:
        warp { cylindrical [CYLINDRICAL_ITEMS...]}
      CYLINDRICAL_ITEMS:
        orientation VECTOR | dist_exp FLOAT
      SPHERICAL_WARP:
        warp { spherical [SPHERICAL_ITEMS...]}
      SPHERICAL_ITEMS:
        orientation VECTOR | dist_exp FLOAT
      TOROIDAL_WARP:
        warp { toroidal [TOROIDAL_ITEMS...]}
      TOROIDAL_ITEMS:
        orientation VECTOR | dist_exp FLOAT | major_radius FLOAT
      PLANAR_WARP:
        warp { planar [ VECTOR , FLOAT ]}

With the `cylindrical, spherical` and `toroidal` warps you can wrap checkers, bricks and other patterns around cylinders, spheres, toruses and other objects. In essence, these warps use the same mapping as the image maps use.

However it does 3D mapping and some concession had to be made on depth. This is controllable by `dist_exp` (distance exponent). In the default of 0, imagine a box <0,0> to <1,1> (actually it is <0,0>, <`dist^dist_exp,dist^dist_exp`>) stretching to infinity along the orientation vector. The warp takes its points from that box.

For a sphere `distance` is distance from origin, cylinder is distance from y-axis, torus is distance from major radius. (or distance is minor radius if you prefer to look at it that way)

Defaults: `orientation <0,0,1>
dist_exp 0
major_radius 1
`

Examples:

       torus {
         1, 0.5
         pigment {
           hexagon
           scale 0.1
           warp {
             toroidal
             orientation y
             dist_exp 1
             major_radius 1
           }
         }
       }
       sphere {
         0,1
         pigment {
           hexagon
           scale <0.5/pi,0.25/pi,1>*0.1
           warp {
             spherical
             orientation y
             dist_exp 1
           }
         }
       }
       cylinder {
         -y, y, 1
         pigment {
           hexagon
           scale <0.5/pi, 1, 1>*0.1
           warp {
             cylindrical
             orientation y
             dist_exp 1
           }
         }
       }

The `planar` warp was made to make a pattern act like an image_map, of infinite size and can be useful in combination with other mapping-warps. By default the pigment in the XY-plane is extruded along the Z-axis. The pigment can be taken from an other plane, by specifying the optional vector (normal of the plane) and float (distance along the normal). The result, again, is extruded along the Z-axis.

#### 3.5.12.7 Bitmap Modifiers

A bitmap modifier is a modifier used inside an `image_map`, `bump_map` or `material_map` to specify how the 2-D bitmap is to be applied to the 3-D surface. Several bitmap modifiers apply to specific kinds of maps and they are covered in the appropriate sections. The bitmap modifiers discussed in the following sections are applicable to all three types of bitmaps.

##### 3.5.12.7.1 The once Option

Normally there are an infinite number of repeating image maps, bump maps or material maps created over every unit square of the x-y-plane like tiles. By adding the `once` keyword after a file name you can eliminate all other copies of the map except the one at (0,0) to (1,1). In image maps, areas outside this unit square are treated as fully transparent. In bump maps, areas outside this unit square are left flat with no normal modification. In material maps, areas outside this unit square are textured with the first texture of the texture list.

For example:

      image_map {
        gif "mypic.gif"
        once
      }

##### 3.5.12.7.2 The map_type Option

The default projection of the image onto the x-y-plane is called a planar map type. This option may be changed by adding the `map_type` keyword followed by an integer number specifying the way to wrap the image around the object.

A `map_type 0` gives the default planar mapping already described.

A `map_type 1` gives a spherical mapping. It assumes that the object is a sphere of any size sitting at the origin. The y-axis is the north/south pole of the spherical mapping. The top and bottom edges of the image just touch the pole regardless of any scaling. The left edge of the image begins at the positive x-axis and wraps the image around the sphere from west to east in a -y-rotation. The image covers the sphere exactly once. The `once` keyword has no meaning for this mapping type.

With `map_type 2` you get a cylindrical mapping. It assumes that a cylinder of any diameter lies along the y-axis. The image wraps around the cylinder just like the spherical map but the image remains one unit tall from y=0 to y=1. This band of color is repeated at all heights unless the `once` keyword is applied.

Finally `map_type 5` is a torus or donut shaped mapping. It assumes that a torus of major radius one sits at the origin in the x-z-plane. The image is wrapped around similar to spherical or cylindrical maps. However the top and bottom edges of the map wrap over and under the torus where they meet each other on the inner rim.

Types 3 and 4 are still under development.

Note: that the `map_type` option may also be applied to `bump_map` and `material_map` statements.

For example:

      sphere{<0,0,0>,1
        pigment{
          image_map {
            gif "world.gif"
            map_type 1
          }
        }
      }

##### 3.5.12.7.3 The interpolate Option

Adding the `interpolate` keyword can smooth the jagged look of a bitmap. When POV-Ray checks a color for an image map or a bump amount for a bump map, it often checks a point that is not directly on top of one pixel but sort of between several differently colored pixels. Interpolations return an in-between value so that the steps between the pixels in the map will look smoother.

Although `interpolate` is legal in material maps, the color index is interpolated before the texture is chosen. It does not interpolate the final color as you might hope it would. In general, interpolation of material maps serves no useful purpose but this may be fixed in future versions.

There are currently two types of interpolation: `interpolate 2` gives bilinear interpolation while `interpolate 4` gives normalized distance. For example:

      image_map {
        gif "mypic.gif"
        interpolate 2
      }

Default is no interpolation. Normalized distance is the slightly faster of the two, bilinear does a better job of picking the between color. Normally bilinear is used.

If your map looks jaggy, try using interpolation instead of going to a higher resolution image. The results can be very good.

More about "Pigment"

- 3.5.1 Pigment in 3.5 Textures
- 3.8.10.4 Pigment in 3.8.10 Texture
- 2.3.4.1 Pigments in 2.3.4 Advanced Texture Options

More about "Normal"

- 3.5.2 Normal in 3.5 Textures
- 3.8.10.5 Normal in 3.8.10 Texture
- 2.3.4.2 Normals in 2.3.4 Advanced Texture Options

More about "Transformations"

- 3.8.5 Transformations in 3.8 Quick Reference
- 2.2.7.1 Transformations in 2.2.7 POV-Ray Coordinate System

More about "warp {turbulence}"

- 3.5.12.6 Warps in 3.5.12 Pattern Modifiers
- 3.5.12.6.4 Turbulence Warp in 3.5.12.6 Warps