I am looking for help in understanding how to generate perlin noise based on several different parameters.
I have successfully generated terrain previously by gathering two perlin points (low octave sample and high octave sample) and combining them. Now I wish to do this type of thing :

that is : creating different ‘modules’ with varying outputs of perlin, and then somehow blending them together.
I have been reading (among many other pages) :
- libnoise: Tutorial 5: Creating more complex terrain
- Perlin Noise generation for terrain - Stack Overflow
… and my head hurts. I cannot see how to factor in these variables :
var persistence : float = 1.0;
var frequency : float = 1.0;
var amplitude : float = 1.0;
var octaves : int = 1;
var randomSeed : int = 1;
From the libnoise tutorial :
I really cannot see the difference between octave and frequency, nor how to implement these two factors.
Amplitude I have concluded is just a percentage of the returned perlin value.
And with Persistence, well I just do not understand where to implement that at all.
So I tried some experimentation :
#pragma strict
public var terrain : Terrain;
var terrainData : TerrainData;
var heightmapWidth : int;
var heightmapHeight : int;
var persistence : float = 1.0;
var frequency : float = 1.0;
var amplitude : float = 1.0;
var octaves : int = 1;
var randomSeed : int = 1;
function Start()
{
GetTerrainData();
}
function Update()
{
if ( Input.GetMouseButtonDown(0) )
{
GeneratePerlinTerrain();
}
}
function GeneratePerlinTerrain()
{
var heightmapData : float[,] = terrainData.GetHeights( 0, 0, heightmapWidth, heightmapHeight );
for ( var y : int = 0; y < heightmapHeight; y ++ )
{
for ( var x : int = 0; x < heightmapWidth; x ++ )
{
// calculate percentage of octave
var pOctave : Vector2 = new Vector2( (parseFloat( octaves ) / heightmapWidth) * x, (parseFloat( octaves ) / heightmapHeight) * y );
// modify with frequency
pOctave *= frequency;
// read perlin
var newHeight : float = Mathf.PerlinNoise( pOctave.x, pOctave.y );
// restrict by amplitude
newHeight *= amplitude;
// apply to height at position x,y
heightmapData[y,x] = newHeight;
}
}
terrainData.SetHeights( 0, 0, heightmapData );
}
function GetTerrainData()
{
if ( !terrain )
{
terrain = Terrain.activeTerrain;
}
terrainData = terrain.terrainData;
heightmapWidth = terrain.terrainData.heightmapWidth;
heightmapHeight = terrain.terrainData.heightmapHeight;
}
But all this is doing is creating a basic perlin output. Is there anyone here who would like to explain and help me understand how I can use all these modifiers before or after reading a perlin noise sample?
You have my thanks just for reading this =]