public void GenerateHeightmap(int octaves, int multiplier, float amplitude, float lacunarity, float persistence, string seed) { SimplexNoiseGenerator gen = new SimplexNoiseGenerator(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { float val = gen.coherentNoise(x, y, 0.0f, octaves, multiplier, amplitude, lacunarity, persistence) * 0.5f + 0.5f; this.heightMap[x, y] = val; } } }
public void Generate() { SimplexNoiseGenerator gen = new SimplexNoiseGenerator(); Texture2D texture = new Texture2D(400, 200); GetComponent <MeshRenderer>().material.mainTexture = texture; for (int x = 0; x < texture.width; x++) { for (int y = 0; y < texture.height; y++) { float val = gen.coherentNoise(x, y, 0.0f, octaves, multiplier, amplitude, lacunarity, persistence); texture.SetPixel(x, y, new Color(val, val, val)); } } texture.Apply(); }