我从Here得到了 Perlin Noise 算法,我想知道是否有办法使地形无限。问题在于这个函数(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;
}
有谁知道如何使这个函数的随机生成器依赖于当前噪声块的偏移量(这些存储在两个变量中,xOffset
和yOffset
)?使用类似的东西Math.pow(xOffset,yOffset)
并将其设置为种子会产生不稳定的、破碎的结果,这些结果根本不起作用。有人有一些见识吗?
任何帮助将不胜感激,谢谢!