So I was experimenting with noise a little bit and I found this code on this forum that generates a 2D noise.
public class NoiseGenerator
{
public static float[][] generateOctavedSimplexNoise(float xTrans, float yTrans, int width, int height, int octaves, float roughness, float scale){
float[][] totalNoise = new float[width][height];
float layerFrequency = scale;
float layerWeight = 1;
float weightSum = 0;
for (int octave = 0; octave < octaves; octave++) {
for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){
totalNoise[x][y] += (float) SimplexNoise.noise(x * layerFrequency,y * layerFrequency) * layerWeight;
}
}
layerFrequency *= 2;
weightSum += layerWeight;
layerWeight *= roughness;
}
return totalNoise;
}
}
It works good for me as long a I am generating single chunks. But when I try to generate the chunks around the initial one they are the same. So I wanted to add a translation so when I leave the first chunk it loads a new chunk that continues the previous one. The Translation that I want to add is like the translation that you have in SiVi http://www.java-gaming.org/topics/sivi-2d-simplex-noise-visualizer-tool/30187/view.html for those that are familiar with it.
But where do I have to apply the Translation. I thought like this:
totalNoise[x][y] += (float) SimplexNoise.noise((x + xTrans) * layerFrequency,(y + yTrans) * layerFrequency) * layerWeight;
. But that makes all chunks empty except the first one.