public void PerlinNoise() { float[,] heightMap = GetHeightMap(); for (int y = 0; y < terrainData.heightmapResolution; y++) { for (int x = 0; x < terrainData.heightmapResolution; x++) { heightMap[x, y] += TerrainOptions.fBm((x + perlinXoffset) * perlinX, (y + perlinYoffset) * perlinY, perlinOctaves, perlinPersistance) * perlinHeightScale; } } terrainData.SetHeights(0, 0, heightMap); }
public void MultiplePerlinNoise() { float[,] heightMap = GetHeightMap(); for (int y = 0; y < terrainData.heightmapResolution; y++) { for (int x = 0; x < terrainData.heightmapResolution; x++) { //adding all the PerlinNoise Curves foreach (PerlinParameters t in perlinParameters) { heightMap[x, y] += TerrainOptions.fBm((x + t.mPerlinXoffset) * t.mPerlinX, (y + t.mPerlinYoffset) * t.mPerlinY, t.mPerlinOctaves, t.mPerlinPersistance) * t.mPerlinHeightScale; } } } terrainData.SetHeights(0, 0, heightMap); }