# Blend different biomes using linear interpolation

I've been scouring the internet for hours looking for a solution to blending biomes that have different amplitudes and frequencies together to create a seamless world. A recurring theme I'm seeing is that they have solved it by using linear or bilinear interpolation. I'm having trouble finding an implementation that would work for me.

Currently each biome is the same noise function but with adjusted frequencies and amplitudes to create variation. The problem is that it would result in "seams" between biomes, for example the plains and a mountains biome.

I think I understand how linear interpolation works. I have functions for it as well, but I'm confused as how to implement it. The game is essentially a 2D Minecraft type game. Would I have to determine the neighboring biomes by doing additional calculations across the x axis for every single block? I'm worried about performance if I somehow do this method.

I'm not sure if this would help but biomes are just determined using three instances of 1D noise, depth, temperature and rainfall. Depth is really just for oceans, but rainfall and temperature determine the biome. I have this basic setup (probably not the best code)

if(biome === 'desert') {
frequency = 0.09;
amplitude = 8;
elevation = 65;
} else if(biome === 'mountain') {
frequency = 0.1;
amplitude = 20;
elevation = 65;
} else if(biome === 'tundra') {
frequency = 0.08;
amplitude = 7;
elevation = 65;
} else if(biome === 'spruce') {
frequency = 0.01;
amplitude = 4;
elevation = 65;
} else if(biome === 'plains') {
frequency = 0.08;
amplitude = 8;
elevation = 65;
} else if(biome === 'forest') {
frequency = 0.008;
amplitude = 7;
elevation = 65;
} else if(biome === 'ocean') {
frequency = 0.2;
amplitude = 9;
elevation = 30;
} else if(biome === 'icy ocean') {
frequency = 0.2;
amplitude = 9;
elevation = 30;
}

var height =
(this.biome.noise.terrain.value(xt * frequency) * amplitude) + elevation;


• If you want help interpolating your biomes, you should probably show us how you generate your biomes at present. That way we can ensure the proposals work with your current strategy. Commented Dec 30, 2019 at 2:03

Globally uniform chunk boundaries

Resolving those chunk edge discrepancies can be done without interpolation. I would suggest using a global function (e.g. 2D Perlin) to define chunk edge heights, so that all chunk edges (at least) align. This is basically like having a series of empty buckets with each neighbour pair of bucket sides having matching heights:

|
|        ||
|   ||   ||        |
|___||___||___||___| etc.


Then you can generate each chunk's internals (___) using a different function per biome, if you wish, just as long as the boundary heights are respected (so that they link up seamlessly). Or you can use the same function e.g. Perlin for all internals, but adjust them through scaling or clipping.

Generating along a smooth slope

However, you still have the problem of finding a function that agrees with those preset edges. Here's one solution.

Let say you start with a straight slope (grey) between two edges (red). You can perturb these surface cells (grey to black).

You can do repeated random perturbations like this, then apply something the algorithm here to ultimately get a smoothly undulating surface between points.