Perlin noise infinite generation/tiling

perlin-noiserandom

I got the Perlin Noise algorithm from Here working, and I was wondering if there was a way to make the terrain infinite. The problem lies within this function(Java):

float[][] GenerateWhiteNoise(int width, int height, int seed)
    {
        Random random;
        random = new Random(seed);
        float[][] noise = new float[width][height];
     
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                noise[i][j] = (float)random.nextDouble() % 1;
            }
        }
        
        System.out.println("Generated White Noise with seed:"+seed+"; xOffset:"+xOffset+"; yOffset:"+yOffset);
     
        return noise;
    }

Does anyone know how to make the random generator for this function rely on the offset of the current tile of noise(these are stored in two variables, xOffset and yOffset)? Using something like Math.pow(xOffset,yOffset) and setting that as the seed produced choppy, broken results that simply don't work. Does anybody have some insight?

Any help would be appreciated, thanks!

Best Answer

Here's tiling 4D noise implemented in a GLSL shader:

http://shaderfrog.com/app/view/254

It's based on the implementation in this answer https://gamedev.stackexchange.com/questions/23625/how-do-you-generate-tileable-perlin-noise/23639

Related Topic