Hello All,
I’ve been slamming my head against a wall at this for a few weeks now and I’m not sure where to go from here. I’m creating an infinitely generated terrain using simplex noise but I cant get my algorithm in a spot where it produces a good result.
Currently what i’m doing is taking a low frequency sample as my base terrain then add a layer of high frequency on top:
float GenerateTerrainTask::GenerateRandomTerrain(int _x, int _y)
{
//initialize vars
float fOutput = 0;
int iFrequency = 0;
//float fLayerTwoNoise = (USimplexNoiseBPLibrary::SimplexNoise2D(_x * fScale * 0.5f, _y * fScale * 0.5f) + 1) / 2; //lower frequency noise layer
int iPersistence = OUTPUT_DEPTH_MAX/2; //set the elevation to be half the height of my chunk which is 256/2=128 units
//uint8 minElevation, maxElevation;
/*place holder*/
/*switch (GetBiome(fLayerTwoNoise, fLayerTwoNoise))
{
default:
break;
case EBiome::VE_OCEAN:
break;
case EBiome::VE_PLAINS:
break;
case EBiome::VE_MOUNTAIN:
break;
}*/
//Get the height of the low frequency layer
iFrequency = 1;
fOutput += (iPersistence * (((USimplexNoiseBPLibrary::SimplexNoise2D(_x * fScale*0.5f * iFrequency, _y * fScale*0.5f * iFrequency) + 1) / 2)));
//add the height of a higher frequency layer with 4 octives
iPersistence = OUTPUT_DEPTH_MAX/8; //reduce how much elevation the high frequency layer will add to 32 units
for (int oct = 0; oct < cOctave; oct++)
{
iFrequency = 2 ^ (oct);
fOutput += (iPersistence*(((USimplexNoiseBPLibrary::SimplexNoise2D(_x * fScale * iFrequency, _y * fScale * iFrequency)+1)/2)));
iPersistence *= .5;
}
return fOutput;
}
The terrain looks very soft and bumpy and produces a lot of circles.The mountain has a very gradual incline by only a single block, but it should be something like 4-5 blocks occasionally.The overall terrain is positioned pretty high even though it starts at origin producing few lakes/oceans.