I'm new to world generation and the algorithms which are used for them, so I hope someone can give me some usefull explanation or code or both or links to some resources I missed while searching for a solution.
How can I get a higher detail level with OpenSimplexNoise?
I know in some algorithms like PerlinNoise can it be done with frequency and adding multiply octaves together. So how can I achieve such a thing with OpenSimplexNoise?
Here is what I've already got:
private static final int WIDTH = 512;
private static final int HEIGHT = 512;
private static final double FEATURE_SIZE = 64;
public static void main(String[] args)
throws IOException {
OpenSimplexNoise noise = new OpenSimplexNoise(1233313l);
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_BYTE_INDEXED);
for (int y = 0; y < HEIGHT; y++)
{
for (int x = 0; x < WIDTH; x++)
{
double value = noise.eval(x / FEATURE_SIZE, y / FEATURE_SIZE);
int rgb = 0x010101 * (int)((value + 1) * 127.5);
image.setRGB(x, y, rgb);
}
}
ImageIO.write(image, "png", new File("noise1.bmp"));
}
And how can I achieve it to have more flat results for forests etc.?
答案 0 :(得分:1)
OpenSimplexNoise不直接提供您所描述的功能,因此您需要自己提供。基本上你反复产生一层噪音&amp;将其添加到最终结果中。更具体地说:
1/(2^n)
,其中n
是当前八度音阶的编号。x y z
参数乘以某个数量来实现此目的。同样,这通常来自八度音程和数字。最常见的例子是2^n
。调整八度音阶数,幅度和幅度频率值更像是一门艺术,而不是科学和技术。取决于你的情况。尝试一下&amp;研究其他人用来找到适合您项目的内容。我使用标准幅度和频率的6个八度音程得到了很好的结果。频率如上所述。