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.?
OpenSimplexNoise does not directly provide functionality you've described, so you'll need to provide it yourself. Basically you repeatedly generate a layer of noise & adding it to the final result. More specifically:
1/(2^n)
where n
is number of the current octave.x y z
parameters by some amount. Again, this is typically derived from the octave number & the most common example mutliple is 2^n
.Tuning the number of octaves, amplitude & frequency values is more of an art than a science & depends highly on your situation. Experiment a bit & research what others have used to find what's right for your project. I get nice results using 6 octaves with the standard amplitude & frequency described above.