So it looks like I’m still getting the streaks on the terrain. Here is a look at what I did:
int width = 1 + terrainSO.AlphaMapResolution * 2 * worldLength;
int height = 1 + terrainSO.AlphaMapResolution * 2 * worldLength;
float[,] noiseMap = NewNoiseMap(width, height, seed, noiseScale,
octaves, persistance, lacunarity, offset);
DrawMesh(noiseMap, meshHeightMultiplier, meshHeightCurve);
float[,] newArray = new float[noiseMap.GetLength(0) - 1, noiseMap.GetLength(1) - 1];
for (int x = 0; x < noiseMap.GetLength(0) - 1; x++)
{
for (int y = 0; y < noiseMap.GetLength(1) - 1; y++)
{
float total = noiseMap[x, y] +
noiseMap[x + 1, y] +
noiseMap[x + 1, y + 1] +
noiseMap[x, y + 1];
total /= 4;
newArray[x, y] = total;
}
}
for (int x = 0; x < noiseMap.GetLength(0) - 1; x++)
{
for (int y = 0; y < noiseMap.GetLength(1) - 1; y++)
{
noiseMap[x, y] = newArray[x, y];
}
}
This is the code leading up to actually setting the heights of the terrain, where I’m creating the noiseMap array.
And here is the code setting the heights:
for (int x = 0; x < terrainSO.Terrains.GetLength(0); x++)
{
for (int z = 0; z < terrainSO.Terrains.GetLength(1); z++)
{
int xStart = terrainSO.AlphaMapResolution * 2 * x;
int xEnd = 1 + terrainSO.AlphaMapResolution * 2 * (x + 1);
int zStart = terrainSO.AlphaMapResolution * 2 * z;
int zEnd = 1 + terrainSO.AlphaMapResolution * 2 * (z + 1);
terrainSO.Terrains[x, z].terrainData.SetHeights(0, 0, NoiseMapFragment(noiseMap, worldLength,
xStart, xEnd, zStart, zEnd));
}
}
There are a few methods there I’m not showing, let me know if it would be helpful to see any of them and I can post them. Really stumped with this!