void GenerateCloudNoise(ref Texture2D tex, int noiseWidth, int noiseHeight, int seed, int scale)
{
float[,] perlinNoise = PerlinNoise.GeneratePerlinNoise(seed, octaves, persistence, noiseWidth, noiseHeight);
float noiseValue;
for (int y = 0; y < noiseWidth; y++)
{
for (int x = 0; x < noiseHeight; x++)
{
noiseValue = perlinNoise[x, y];
noiseValue *= SimplexNoise.SeamlessNoise((float)x / (float)_texWidth, (float)y / (float)_texHeight, scale, scale, 0f);
noiseValue = Mathf.Clamp(noiseValue, contrastLow, contrastHigh + contrastLow) - contrastLow;
noiseValue = Mathf.Clamp(noiseValue, 0f, 1f);
var brightOff = Random.Range(-0.01f, 0.01f);
float r = Mathf.Clamp(CloudColor.r + brightOff, 0f, 1f);
float g = Mathf.Clamp(CloudColor.g + brightOff, 0f, 1f);
float b = Mathf.Clamp(CloudColor.b + brightOff, 0f, 1f);
tex.SetPixel(x, y, new Color(r, g, b, noiseValue));
tex.SetPixel(511 - x, y, new Color(r, g, b, noiseValue));
tex.SetPixel(x, 511 - y, new Color(r, g, b, noiseValue));
tex.SetPixel(511 - x, 511 - y, new Color(r, g, b, noiseValue));
}
}
tex.Apply();
}