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