Figure 1: Now deeper in the cave, yet more evidence was found arguing for an advanced aesthetic among the Mousterian people.
-turbulence is a multi scale noise renderer akin to -plasma, in that it typically replaces the content of selected images with a turbulent effect, though it proceeds through different means and achieves distinctly different results.
Proceeding through a series of cycles or octaves, the command blurs Gaussian noise, subjects it to a mixing function, then scales and blends the results with those from previous octaves, integrating features distinct to each into a final result, one that exhibits irregular blotches and other structures, often appearing at different scales and which can vary considerably in character.
The types and sizes of features present in the results generally increase with additional octaves. That, along with the choice of a particular mixing function, the amount of damping between each octave, and the radius of the Gaussian blurring kernel which filters raw noise, gives rise to a host of effects that can emulate clouds, rock or wood.
Like plasma, turbulence may be harnessed to make height maps for lighting effects and textures. The stone wall in the opening figure was generated, in part, from a turbulence height map. The Finger painting recipe in the Cookbook describes the lighting model that draws out the features of the surface.
The format of the command is:
-turbulence: radius>0,octaves={1,2,3...,12},decay>0,difference={-10,10},mode={0,1,2,3,4,5}
Figure 2: A schmatic of turbulence operation. For each octave, the command blurs noise at a variance radius that is halved as octaves proceed, so that smoothed noise exhibits little detail at low octaves, more at higher ones. The command then applies a mixing function to the smoothed noise. This may be a power function to square or cube the noise, or it may be a conversion to absolute values, folding negative regions to the positive and creating discontinuities at zero crossings. The decay argument progressively damps the higher octaves. The command blends and rescales these octave-based slices into a final image.
Turbulence goes through a set number of cycles called octaves. The command develops features at different scales by halving, at each octave, the initial radius given as an argument for the low pass filter. As a consequence, only very low frequency features are present in the smoothed noise function produced during the initial octave. However, in the second and subsequent octaves, the radius is halved and halved again, admitting, at each octave, progressively higher frequency components and concomitantly finer detail. In effect, each octave is responsible for a particular level of detail, and with more octaves, a wider gamut of detail may be obtained, limited, as noted, by the dimensions of a single pixel, for it is pointless to generate detail smaller than that quantum unit.
Each octave begins with the introduction of a standard noise function, its point-wise values ranging from negative to positive ten and exhibiting a Gaussian distribution around a central value of zero (See -noise, in particular its Gaussian mode, mode 0). By definition, the function cannot be differentiated in any direction.
A low-pass filter with a Gaussian kernel filters this function, producing a smoothed noise function. Unlike the source noise, one may differentiate this function, and it may have a small positive or negative bias. However, it's most salient aspect is a loss of high frequency components to a degree established by the radius argument. This establishes feature size, which becomes a characteristic of the octave, and with the first octave exhibiting the largest features, having been filtered for all but the lowest frequencies present in the noise.
Next, the smooth noise function may be mixed, an occurrence dependent the mode. As noted above, Mode 2 does not apply a mixer at any octave. Modes 1 and 3 apply mixers only at the first octave. Modes 0, 4, and 5 apply mixers at all octaves.
Mode |
Mix First Octave |
Mix Remaining Octaves |
Mixer |
---|---|---|---|
0 |
√ |
√ |
i → |i| |
1 |
√ |
i → |i| |
|
2 |
|||
3 |
√ |
i → i2 |
|
4 |
√ |
√ |
i → i2 |
5 |
√ |
√ |
i → i3 |
There are three types of mixers. Modes 0 and 1 subtract any bias that may be in the smoothed noise function so that its average value is zero. The command then takes the point-wise absolute value of the smoothed noise function which leaves non-negative values unchanged but wraps negative values to positive; they retain their magnitudes but their signs change. This produces local discontinuities at former zero-crossings, and these appear as cracks or creases in the final output. Modes 3 and 4 point-wise squares the smoothed noise function, which flips negative values but retains first derivative continuity at former zero crossings. Creases do not appear with this mixer. Finally, Mode 5 point-wise cubes the smoothed noise function, which tend to form isolated positive and negative spikes of large value in fields that are otherwise nearly zero, on average.
Excepting the first, all octaves blend their (possibly mixed) smoothed noise functions with the aggregated noise functions stemming from prior octaves. This is a two-step process:
The process implements the so-called decay of later smoothed noise functions through a little indirection. The erstwhile decay factor scales the aggregate as it transitions from octave to octave. When the decay factor is greater than one, the aggregate grows in magnitude from octave to octave. However, the smoothed noise function produced at each octave generally remains at the same order of magnitude as the original Gaussian noise distribution: ±10; that means the smoothed noise functions become relatively smaller than the aggregate as octaves increase, applying correspondingly smaller perturbations.
Thus, for a decay factor of three, the contribution of the first octave will be raised by 3 to the power of the number of requested octaves. For twelve octaves, the component added by the smoothed noise function of the first octave will be magnified approximately 312 or 530,000 times compared to that of the smoothed noise function produced by the twelfth octave. In a practical sense, then, the latter smoothed noise functions have been decayed with respect to the earlier ones.
One is at perfect liberty to set a decay factor less than one; the results are of limited utility. In this case, the smoothed noise functions produced by later octaves dominate, as their sizes are on the same order of magnitude as the aggregate. However, the low pass filter applied to these late-stage smoothing functions have small radii kernels, and consequently the smoothed noise functions do not differ much quantitatively from Gaussian noise; such results may be obtained much more cheaply by invoking -noise directly.
Following the last blending, the turbulence command scales the aggregate to the range 0,255, suitable for paint programs with unsigned eight bit character pipelines. If there is a non-zero difference argument, the turbulence command scales the selected image by the difference argument and subtracts the turbulence from it, re-normalizing the blend.
We apply a figurative (maybe even a poetic) oscilloscope to the schematic in Figure 2, illustrating some of the more salient aspects of turbulence generation. These correspond to a single row from a 1024 × 1024 turbulence image as it emerges from the primordal soup. The arguments given to the turbulence command were radius: 128, octaves: 10, decay 2.25, difference 0, and mode 0.
The chart on the left graphs two curves near the beginning of the of the flowchart in Figure 2. The blue curve ("Base") is the smoothed noise function produced from noise exhibiting a Gaussian distribution centered on zero and ranging between -10 and 10. It emerges from the box labeled "Low Pass Filter 1st Octave" and because the mode has been set to O, it passes through the decision diamond from left to right and enters the box labeled "Mix 1st Octave." The large variance (radius of 128) has removed all but the lowest frequency components. When running in Mode 0, the mixer applies the -abs (absolute value) command to its input, after subtracting any bias. This reflects the negative-valued regions of the input curve about the zero axis, making a crease at the old zero-crossing point. This reflection is analogous to "stirring" the curve (as in stirring a cup of coffee or a bucket of paint). This particular flavor of stirring is interesting because the crease introduces new high frequency components to a curve which has been stripped of them. These kinds of repetitive give-and-take processes are hallmarks of multi-scale noise generators. The orange curve is the output of the mixing block; it enters the repetitive loop part of the schematic at the box labeled "Radius ÷ 2N". |
|
Every passage around the loop finds the generation of a new smoothed noise function filtered by a low-pass filter that employs a convolution kernel one half the size from that used in the previous passage. That means the the smoothed noise functions acquire increasingly higher frequency components, In this intial pass, we see little of that, but will see more in the following panels. Since we are in Mode 0, the new smoothed noise function also gets reflected around the zero axis, making a new crop of creases. It is now ready to "perturb" the aggregation curve. The orange curve is very nearly the same as the "Reflected" curve from the previous panel, but it has been scaled by the decay factor, 2.25, so it is now larger and also the "aggregation curve". In this first loop, it has only aggregated one curve and is about to aggregate a second. These data are the input for the "Aggregation" box in the Figure 2 schematic. The dark blue curve is the result of blending the orange and blue curves and becomes the new aggregate for the second octave's traversal around the loop. |
|
For sake of brevity, we let processes percolate for octaves 2, 3, and 4 and present another snapshot entering the "Aggregation" block. The orange curve is the aggregate, having now absorbed three curves, and the pale blue curve is the smoothed and mixed noise curve produced in the current octave. It is not particularly smaller than smoothed noise functions of previous octaves; it is that the aggregator has grown bigger, so the degree in which the present smoothed noise function will perturb the aggregate is smaller. The other interesting aspect of the smoothed noise function is that it is the "lumpiest" one yet. The convolution kernel has been halved, halved, and halved again, and so is not nearly the low-pass filter that it once was. The dark blue curve is the output of the Aggregator block, and is about to commence octave five. We have now seen the essence of this noise generator, the successive layering of finer (higher frequency) detail at successively smaller scales. |
|
Having guessed the plot of this story, we fast forward to the last paragraph to see if the Good Guy gets it in the end (gets what? the treasure? the meaning of Life? the full metal jacket bullet? Ah. We're digressing...) There's nothing new here in this third snapshot at the front door of the Aggregation box. The smoothed noise function is no longer very smooth, nor is it very big in relation to the aggregate, which has become huge. The dark blue curve is hardly perturbed at all from the ultimate minus one version; probably ten octaves is about right. Twelve would not have been meaningfully different. It is worth noting that the soon-to-be-output aggregate largely bears the rise and fall of the first smoothed noise function, which mainly set the shape of the curve. The products of subsequent octaves applied fiver detail at smaller scales, and we're now at the point where the detail approaches single pixel scales. |
|
— |
Garry Osgood