### Section 7.6.7.24
Wrinkles

The wrinkles pattern was originally designed only to be used as a normal pattern. It uses a 1/f noise pattern similar to granite but the features in wrinkles are sharper. The pattern can be used to simulate wrinkled cellophane or foil. It also makes an excellent stucco texture.

When used as a normal pattern it uses a specialized normal perturbation function. This means that the wrinkles pattern cannot be used with normal map, slope map or wave type modifiers in a normal statement.

When used as a pigment pattern or texture pattern, the wrinkles pattern is similar to normal wrinkles but is not identical as are most normals when compared to pigments. When used in pigment or texture statements the wrinkles pattern uses the ramp_wave wave type by default but may use any wave type. The pattern may be used with color_map, pigment_map and texture_map.

### Section 7.6.8
Pattern Modifiers

Pattern modifiers are statements or parameters which modify how a pattern is evaluated or tells what to do with the pattern. The modifiers color_map and pigment_map apply only to pigments. See section "Pigment". The modifiers bump_size, slope_map and normal_map apply only to normals. See section "Normal". The texture_map modifier can only be used with textures. See section "Texture Maps".

The pattern modifiers in the following section can be used with pigment, normal or texture patterns.

### Section 7.6.8.1
Transforming Patterns

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

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

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.

### Section 7.6.8.2
Frequency and Phase

The frequency and phase modifiers act as a type of scale and translate modifiers for color_map, pigment_map, normal_map, slope_map and texture_map. This discussion uses a color map as an example but the same principles apply to pigment maps, normal maps, slope maps and texture maps.

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 isn't 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'd 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's a pain. A phase adjustment will shift everything but keep the same scale. Try animating a mandel pigment for a color palette rotation effect.

Frequency and phase have no effect on block patterns checker, brick and hexagon nor do they effect image maps, bump maps or material maps. 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 ripple or waves to move relative to their center for animating the features.

These values work by applying the following formula

      NEW_VALUE = fmod ( OLD_VALUE * FREQUENCY + PHASE, 1.0 ).

### Section 7.6.8.3
Waveform

Most patterns that take color_map, pigment_map, slope_map, normal_map or texture_map use the entries in the map in order from 0.0 to 1.0. 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 difference can easily be seen when these patterns are used as normal patterns with no maps.

Patterns such as gradient or onion generate a grove or slot that looks like a ramp that drops off sharply. This is called a ramp_wave wave type. However wood and marble slope upwards to a peak, then slope down again in a triangle_wave. In previous 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 and scallop_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.

Although any of these wave types can be used for pigments, normals or textures, the sine_wave and scallop_wave types are not as noticeable on pigments or textures as they are for normals.

Wave types have no effect on block patterns checker, brick and hexagon nor do they effect image maps, bump maps or material maps. 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.

### Section 7.6.8.4
Turbulence

The keyword turbulence followed by a float or vector may be used to stir up any pigment, normal, texture, irid or halo. A number of optional parameters may be used with turbulence to control how it is computed. For example:

      pigment  {
        wood color_map { MyMap }
        turbulence TURB_VECTOR
        octaves FLOAT
        omega FLOAT
        lambda FLOAT
      }

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.

In general the order of turbulence parameters relative to other pattern modifiers such as transformations, color maps 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. See section "Warps" for a way to work around this behavior.

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 Don't 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:

Turbulence random walk.

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.

### Section 7.6.8.5
Octaves

The octaves value controls 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 won't 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.

### Section 7.6.8.6
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.

### Section 7.6.8.7
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.

### Section 7.6.8.8
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 three types of warps but the syntax was designed to allow future expansion. The first two, the repeat warp and the black_hole warp are new features for POV-Ray that modify the pattern in geometric ways. The other warp provides an alternative way to specify turbulence.

The syntax for using a warp statement in a pigment is

      pigment {
        PATTERN_TYPE
        PIGMENT_MODIFIERS...
        warp { WARP_ITEMS...}
        OTHER_PIGMENT_MODIFIERS...
      }

Similarly warps may be used in normals and textures. 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.

### Section 7.6.8.8.1
Black Hole Warp

A black hole 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. Unlike the real thing, however, it won't swallow you up and compress your entire body to a volume of, say, 2.0 10-10 microns in diameter if you get too close (We're working on that part).

Take, for example, a woodgrain. 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 localised disturbance in a woodgrain 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 woodgrain, it would look to the viewer as if there were a knothole in the wood. In this text we use a woodgrain regularly as an example, because it is ideally suitable to explaining black holes. However, black holes may in fact be used with any texture.

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:

      warp
      {
        black_hole <CENTER>, RADIUS
        [falloff VALUE]
        [strength VALUE]
        [repeat <VECTOR>]
        [turbulence <VECTOR>]
        [inverse]
      }

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
      }

In order to fully understand how a black hole works, it is important to know the theory behind it. A black hole (or any warp) works by taking a point and perturbing it to another location. The amount of perturbation depends on the strength of the black hole at the original point passed in to it. The amount of perturbation directly relates to the amount of visual movement that you can see occur in a texture. The stronger the black hole at the input co-ordinate the more that original co-ordinate is moved to another location (either closer to or further away from the center of the black hole.)

Movement always occurs on the vector that exists between the input point and the center of the black hole.

Black holes are considered to be spheres. For a point to be affected by a black hole, it must be within the sphere's volume.

Suppose you have a black hole at <1,1,1> and a point at <1,2,1>. If this point is perturbed by a total amount of +1 units its new location is <1,3,1>, which is on a direct line extrapolated from the vector between <1,1,1> and <1,2,1>. In this case the point is pushed away from the black hole, which is not normal behaviour but is good for demonstration purposes.

The internal properties of a black hole are as follows.

Center | The center of the black hole.
Radius | Its radius.
Falloff | The power of two by which the effect falls off (default 2.)
Strength | The magnitude of the transformation effect (see below.)
Inverted | If set, 'push' points away instead of 'pulling' them in.
Repeat | If set, we have many black holes instead of one.
Turbulence | If set, each new repeated black hole's position is uncertain.
Repeat_Vector | The <x,y,z> factor to repeat by.
Turbulence_Vector | The maximum <x,y,z> factor for turbulence randomness.

Each of these are discussed below.

Center: A vector defining the center of the sphere that represents the black hole. If the black hole has Repeat set it is the offset within each block.

Radius: A number giving the length, in units, of the radius of the sphere that represents the black hole.

If a point is not within radius units of <center> it cannot be affected by the black hole and will not be perturbed.

Falloff: 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 centre 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 permiter 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 magnitude of the movement of the point is determined basically by the value of force after scaling. We'll consider scaling later. Lets take an example.

Suppose we have a black hole of radius 2.0 and a point that is exactly 1.0 units from the center. That means it is exactly half-way to the center and that c would be 0.5. If we use the default falloff of 2 the force at that point is 0.5^2 or 0.25. What this means is that we must move the point by 0.25 of its distance from the center. In this case it is 1.0 units from the center, so we move it by 1.0*0.25 or 0.25 units. This gives a final distance of 1.0-(1.0*0.25) or 0.75 units from the center, on a direct line in 3D space between the original position and the center.

If the point were part of, say, a wood grain, the wood grain would appear to bend towards the (invisible) center of the black hole. If the Inverse flag were set, however, it would be pushed away, meaning its final position would be 1.0+(1.0*0.25) or 1.25 units from the center.

Strength: The Strength gives 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 centre of the black hole where all points whose final force value exceeded or equaled 1.0 were moved by a fixed amount.

Inverted: If Inverted is set points are pushed away from the center instead of being pulled in.

Repeat: Repeat 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.

If you're not interested in the theory behind all this, just skip the following text and use the values given in the summary below.

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 neighbouring 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 can't 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.

Turbulence: Turbulence can only be used 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 back hole in an array, after each axis of the vector is multiplied by a different random amount ranging from 0 to 1.

For example, suppose you have a repeating element of a black hole that is supposed to be at <2,2,2>. You have specified a turbulence vector of <4,5,3>, meaning you want the position to be able to vary by no more than 1.0 units in the X direction, 3.0 units in the Y direction and 2.0 in Z. This means that the valid ranges of the new position are as follows

    X can be from 2 to 6.
    Y can be from 2 to 7.
    Z can be from 2 to 5.

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 co-ordinates.

There is a rider on the use of turbulence, which basically is the same as that of the repeat vector. You can't specify a value which would cause a black hole to potentially cross outside of its particular block.

Since POV-Ray doesn't know in advance how much a position will be changed due to the random nature of the changes, it enforces a rule that is similar to the one for Repeat, except it adds the maximum possible variation for each axis to the center. For example, suppose you had a black hole with a center of <1.0, 1.0, 1.0>, radius of 0.5 and a turbulence of <0.5, 0.25, 0> - normally, the minimum repeat would be <1.5, 1.5, 1.5>. However, now we take into account the turbulence, meaning the minimum repeat vector is actually <2.0, 1.75, 1.5>.

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

Next Section
Table Of Contents