So I already have some (currently 2D possibly 3D later) simplex noise generation going, and with some experimenting I can make a map for plains, hills, mountains, etc
The problem now is I want to combine those together to create a larger more interesting map. For each "pixel" in the height map I provide/generate a biome type which has a bunch of parameters to define how the height value is calculated etc. i.e. I want to be able to say mountains here, river through there, flood plains next to it, etc and have them blend together.
The problem is this leaves nasty borders since between them even the simplex input values change suddenly (due to the x/z scaling being different, perhaps not the best way?). I considered just doing like a post process to smooth out the height values along the borders, but this would still leave often steep (and uninteresting near constant gradient) slopes since I could have a valley one side and a mountain peek the other side.
I am sure there must be a better fairly standard way to do this, but have not found much searching around, at least for this sort of noise function (midpoint displacement can be seeded with initial values at a low resolution, but doesn't seem viable if not generating the entire map at once)
double getHeight(int x, int z, Biome biome)
{
double nx = x;
double nz = z;
nx *= biome.xzNoiseScale();//e.g. 1/64
ny *= biome.xzNoiseScale();
double noise = fbm(nx, nz, biome.noiseOctaves(), biome.noiseLacunarity(), biome.noiseGain());
return biome.baseHeight() + noise * biome.heightVariation();
}
double fbm(double x, double z, int octaves, double lacunarity, double gain)
{
double amp = 1;
double freq = 1;
double sum = 0;
for (int i = 0; i < octaves; ++i)
{
sum += amp * noise(x * freq, y * freq);
amp *= gain;
freq *= lacunarity;
}
return sum;
}