I ran into some issues creating some Procedurally generated terrains; I am running different noise functions when switching between biomes, and this causes these ugly gaps that i dont know how to fix!
So far i’ve tried clamping the y values at the highest Y value and it didnt work well. Then i tried getting the mean the total Y values and clamping it by that, it sort of worked, But i’m looking to really smoothen this out.
If you can create fuzzy biome borders you could use that for interpolation variables. Something kinda like this:
Red would be desert and green would be grassy hills here. Add up the biome weights of all biomes that affect a cell to get a total value, then figure out what percentage of the weight a biome has out of this total to get the weight for that biome:
local desertHeight = GetBiomeHeight("desert")
local desertWeight = GetBiomeWeight("desert")
local grassyHillHeight = GetBiomeHeight("grassy_hill")
local grassyHillWeight = GetBiomeWeight("grassy_hill")
local totalWeight = desertWeight + grassyHillWeight
local desertCoefficient = desertWeight / totalWeight
local grassyHillCoefficient = grassyHillWeight / totalWeight
local finalHeight = desertCoefficient * desertHeight + grassyHillCoefficient * grassyHillHeight
If you don’t have a function that has fuzzy borders like these then you could try using a blurring function. Be careful with how you use those though because they can be pretty slow depending on how they’re calculated. I’d recommend some form of Gaussian blur, like two pass blur where you blur horizontally, then vertically.
Something kinda like this should smooth out the height maps of multiple biomes. There are a lot of other things you could do to tweak and adjust it though, like changing fall off distances for biomes.
Give flatter biomes like desert a larger fall off distance, so the terrain doesn’t harshly transfer in terrain that should look relatively flat, and give more hectic terrain like grassy hills a faster fall off.
This should at least make the biome borders consistent.