Hello.

Today I've implemented a perlin noise algorithm with extra methods like pertubation and eroding to create a terrain.

I found the code for it here: Click me

After the "addPerlinNoise()" method, you can see 3 reference pictures on that page (in the middle), build with the frequencies 1.0f, 4.0f and 1.0f + 8.0f (without perturb or sth like that, just plain noise).

If I use a frequency of 4.0f, this is my output (plain noise): https://imgur.com/7OElD3n

And when I use 64.0f as my frequency, I get this: https://imgur.com/dqA04N6

Can you help me to achieve something like the reference pictures with the reference frequencies (1.0f, 4.0f, 1.0f + 8.0f)?

I only understand a little behind the maths of it, so I can't really do something to fix it.

The code on the linked site is in C#, mine is in C++.

The only things, which are different between my code and the code on the site is the following part:

void PerlinGenerator::initGradients() { //Type of random number distribution std::uniform_real_distribution<float> dist(0.0f, 1.0f); //(min, max) //Mersenne Twister: Good quality random number generator std::mt19937 rng; //Initialize with non-deterministic seeds rng.seed(std::random_device{}()); for (int i = 0; i < gradientTableSize; i++) { float z = 1.0f - 2.0f * dist(rng); float r = (float)sqrt(1.0f - z * z); float theta = 2 * (float)M_PI * dist(rng); gradients[i * 3] = r * cos(theta); gradients[i * 3 + 1] = r * sin(theta); gradients[i * 3 + 2] = z; } }

Can it be the random double, which is used for the computing?

For the rendering I determine the vertex coordinates for a VBO like this and render it with glDrawElements(...) :

void Terrain::createVBO() { // Create vertex data float *vertices = new float[3 * heightMap->size * heightMap->size]; float blockSize = 16.0f; int vertex = 0; for (int y = 0; y < heightMap->size; y++) { for (int x = 0; x < heightMap->size; x++) { vertices[vertex++] = x * blockSize; vertices[vertex++] = y * blockSize; vertices[vertex++] = heightMap->heights[y][x] * blockSize; } } // Create index data [...] // Create VAO [...] // Create VBO [...] // Create EBO [...] // Handle vertex attributes in shader prog [...] }

Hopefully you can help me, thanks,

NightDreamer