Hierarchical Function Applet
This applet contains a one-dimensional hierarchical function similar to the two- dimensional function I use to generate the terrain in TEP. Most aspects of the function can be controlled. See the bottom of the page for more details.
About Hierarchical Functions
I don't know what these functions are actually called, if anything. They are commonly associated with level of detail algorithms. They are defined in a hierarchical manner (as I will describe below) so I'm calling them hierarchical functions. A hierarchical function is defined on a succession of grids with spacing d, d/2, d/4, d/8, etc. to any desired level of detail. The function is generated from a rule that says how to fill in the points at the next finer level of detail from the points at the previous level. For instance, going from spacing d to spacing d/2, the rule must explain how to evaluate the function at d/2, 3d/2, 5d/2, etc. The values of the function at 0, d, 2d, etc. are already set. In terrain generation, this helps suppress "popping", the surprising appearance or disappearance of features as the level of detail changes. Since as each new level comes in half the points are the same, the terrain is somewhat limited in how much it can change.
This applet lets you explore a variety of rules for filling in the functions. The top-level function is initialized to evenly distributed random numbers. The rules used here (and most of the rules I have ever used) start by interpolating between the adjacent values (i.e., f(d/2) is (f(0)+f(d))/2 + some variation.) The variation is what changes from rule to rule.
There are several different underlying hierarchical functions that can be plotted. The function type is selected from the Choice at the upper right of the applet.
The simplest function is labeled "random"; it is a basic one-variable function which computes the variation at each level based on a pseudo-random number seeded from the coordinate scaled by the weight at that level. The lower-numbered levels are coarser, so for example the "Level 0 Amplitude" slider controls the coarse-variation magnitude, and the higher-numbered levels control finer amplitude variation.
The roughness[a,b] functions actually use the weights to control a "roughness", which is also a hierarchical function. The roughness is a measure of how fast the amplitude of variation dies off with increasing level in the plotted function. For roughness[0.5,1.5], it dies off between exp(-0.5 * level) and exp(-1.5 * level), and so on. Roughness[1,2] is the most similar function here to what I'm actually using for the terrain. A high roughness causes jagged spikes, and a low roughness causes smooth terrain. A jagged roughness function causes rapid variation between smooth terrain and jagged terrain.
"Second derivative"is a function I'm working on to mimic clouds. It's still pretty lousy. As I get better functions, I'll try to keep this page updated.
The sliders give manual control of the amplitudes of variation at each level of detail. Certain combinations of amplitudes give particularly reasonable results; the sliders can be reset en masse to those combinations by choosing something for the "Reset Weights to" Choice. These choices are pretty self-explanatory functions of the level number l.