/// <summary> /// A noise with multiple octaves has abominated value (the more octaves, the higher), /// so we have to find out the modifiers that would normalize the values again. In order /// not to calculate it for each possible persistence, we do it for 10 values of persistence /// and then will use approximations. /// </summary> private static Dictionary <int, float> InitializeAfterNoiseAdjustments(int octaves) { var dictionary = new Dictionary <int, float>(); for (int i = 0; i <= 10; i += 1) { float persistence = ((float)i) / 10; float maxValueFromNoise = Perlin.MaxValueFromNoise(octaves, persistence: persistence); float maxValueFromNoiseInverted = 1 / maxValueFromNoise; dictionary[i] = maxValueFromNoiseInverted; } return(dictionary); }