[Solved] SimpleXnoise Translation.

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.

[EDIT: Basically this post was quite off base, so the simplest thing is to just delete it.]

So I changed the code to this:

totalNoise[x][y] += (float) SimplexNoise.noise((x * layerFrequency) + xTrans,((y * layerFrequency)) + yTrans) * layerWeight;	             }

So now the layerweight is applied to each result. But the world still cuts of at the chunk borders.

First off, I apologize for not reading your question more closely. I didn’t notice that you want the chunks to be contiguous. I also didn’t notice that you had consulted SiVi! ::slight_smile: I need to slow down.

Maybe get rid of the roughness calculation? Or make roughness = 1. I think this is complicating things in an unhelpful way.

So, your first solution was correct.

totalNoise[x][y] += (float) SimplexNoise.noise((x + xTrans) * layerFrequency,(y + yTrans) * layerFrequency) * layerWeight;

When calling the generatedOctavedSimplexNoise function, the xTrans argument should equal a multiple of width, and yTrans should equal a multiple of height. The multiple would correspond to the number of chunks distance from the original chunk where xTrans and yTrans are both 0.

What does it mean when you say the chunks are “empty”? Are they drawing black? white? Is there literally no data in the returned array? Is it all 0? Is there data > 1 or < -1?

By the way, I never tested that particular noise generation algorithm, and it might be breaking down for certain input values.

If I understand it correctly, it is designed to always produce the same relationship between the overlays, where each higher (faster varying) octave has half the weight of the previous.

I think it is useful to specify scalings and weights to individual overlays of the noise, and to use as few overlays as necessary to make the desired effect, as each “octave” adds significantly to cpu expense. For example, a graphic with “octaves” of 1, 2, 4, 8 might also work with “octaves” of 1, 3, 8, costing 25% less.

Solved!!! Thanks so much!!!