Hi there, I'm the author of the terrain generation articles being discussed. AndiNo recently contacted me for clarification of some things, so I thought I would respond here as well.
For the most part, most of what I used in the articles has a 1 to 1 mapping with the functions provided by libnoise, with the chief exception being the gradient function, so I will paste the explanation of the gradient function that I gave to AndiNo.
Here is the basic structure of the gradient function:
Code:
double dx=x-m_gx1;
double dy=y-m_gy1;
double dz=z-m_gz1;
double dp=dx*m_dx+dy*m_dy+dz*m_dz;
dp=clamp(dp/m_vlen,0.0,1.0);
return lerp(dp,1.0,-1.0);
The function maintains 2 control points which are set when the function is initialized. The second point (m_gx2, m_gy2, m_gz2) is subtracted from the first point (m_gx1, m_gy1, m_gz1) to obtain the length of the segment, m_vlen, as well as the vector components (m_dx, m_dy, m_dz) which represent the vector of the line-segment (not normalized, since the normalization operation occurs when dp is divided by m_vlen). Basically, every time you call get(x,y,z) on the function, the input point is projected onto that line segment using a dot-product operation with (m_dx,m_dy,m_dz), and the result is normalized and clamped to the range [0,1] then used to interpolate from -1 to 1 for the output. This creates a gradient field, aligned along the axis defined by the segment, where values that lie beyond one end fall in the -1 range, values that lie beyond the other end fall in the 1 range, and values inbetween fall in a smooth gradient from -1 to 1.
When this gradient is modified by a threshold, or step, function you get the result that somewhere within that gradient range, the function value changes abruptly from -1 to 1, rather than the smooth gradient. Since I align the gradient along the Y axis, this has the effect of creating a ground plane at the value of Y corresponding to the value of output that I set the threshold of the step function to. When this ground plane is deformed by turbulence, that is where the hills and valleys occur, as turbulence applied along the Y-axis of the gradient function "pushes" and "pulls" values above or below that threshold.
Additionally, you can implement a domain transformation function (I believe libnoise implements that as ScalePoint) with a scale for the Y-axis of 0. This has the effect of making the Y-axis turbulence act more like a traditional heightmap, pushing entire columns of cells/voxels up or down the gradient, rather than each voxel separately. I have found this useful as a starting point to implement more traditional and less "frothy" features.
Other than that, I believe that most of the other modules are similar to libnoise, just with a different interface. Select maps to libnoise::Select, and so forth.
If anyone has additional questions, I can be reached over at the gamedev.net forums.
Thanks,
Josh Tippetts