I have got an arbitary number of perlin noise maps and a weight for each. The sum of all weights is 1, but that shouln't make a difference.
I want to get that noise with the highest value regarding the weight.
My first approach was to get the numbers from each perlin noise, convert these to percentages (I've got a loopup table therefor), multiply with the weight and select the hightest value. But this approach has a huge flaw: It discriminates smaller weights and favores the larger ones and so messes up the distribution. I want a weight of 0.2 to appear in 20%.
I want to use this for a map generator to select a tile type. I use multiple perlin noises because I want to use many different tile types to border on each other and thus can't use a gradient.
Does anyone know how to fix this flaw, or a different way to generate tile based maps?
EDIT: Meanwhile I figured out a nearly acceptable solution:
final float[] values = new float[noises.length];
for (int i = 0; i < values.length; i++)
values[i] = noises[i].get(x, y) * (1f + (weights[i] - 1f / noises.length));
int max = 0;
for (int i = 1; i < values.length; i++)
if (values[i] > values[max])
max = i;
return noises[max];
It's only flaw is being imprecise. Even with a weight of 0f a noise will still be retured in about 6% of all times.