'How to interpolate between multiple biome height-maps?
For biome area distribution I combine perlin noise representing temperature, and moisture levels using voronoi cell distribution. The world is divided by some modulo and another perlin noise function to return a voronoi control point. The seams between biomes show. I thought a simple weight function will do:
Orange point = the sample point which the weights will be calculated according to.
Using cellular noise (some kind of voronoi distribution similar to what I'm looking for, but doesn't blend different biomes):
To clarify vertex height:
float HeightAtPosition(float x, float z)
{
//Returns an array containing information of all the adjacent biome
//control points(mainly their position and their biome type)
BiomeControlPoint[] adjacentControlPoints = GetAdjacentBiomePoints(x, z);
//Returns an array containing values between 0 and 1
//Iputs: An array of all the adjacent biome points, a sample coordinate
//Output: A float array containing the weight of each biome on the
// coordinate(between 0 and 1)
float[] weights = CalcWeights(adjacentControlPoints, new Vector2(x, z));
float finalHeight = 0;
for (int i = 0; i < adjacentControlPoints.Length; i++)
{
finalHeight += adjacentControlPoints[i] * weights[i];
}
return finalHeight;
}
A good solution if GetAdjacentBiomePoints(x, z)
and CalcWeights(adjacentControlPoints, new Vector2(x, z))
were more performance efficient. Bilinear interpolation I don't understand.
Solution 1:[1]
You could try a weighted voronoi diagram. My php implementation:https://tetramatrix.github.io/awvd/.
Solution 2:[2]
You could go the other way:
- generate temperature and moisture levels for each pixel
- generate how much each biome matches those values
- precalculate strength of each biome as a 2d lookup table?
- take the X best matches
- normalize the strengths (sum is 1)
- your a unique noise function combination is weighted sum of the X best biomes
Personally I work with gridmaps and interpolate the biome's valus from a small map with large cells to a large map with small cells. Interpolation is much easier there:
Sorry that it is java.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Micromega |
Solution 2 | Orchaldir |