crush3dice
crush3dice

Reputation: 316

2d Perlin noise. Why do i have to take the dotproduct of displacement and gradientvector?

Taking this into account, i do not understand why i have to take the dotproduct of the gradient vector and the displacement of my point to it. Can anyone explain me why i have to do that? I actually understand this tutorial, where they just took a simple blur to calculate the value of the grid point (called smooth noise). The linear interpolation is in both cases clear to me. So can anyone explain me why they take the dotproduct of the displacement and so called "gradientvector" in the first tutorial? What effect has it?

Upvotes: 3

Views: 811

Answers (1)

crush3dice
crush3dice

Reputation: 316

Ok i figured it out myself now. The first tutorials noise is a so called gradient noise, while the second tutorials one is a value noise. The classic perlin noise by ken is a gradient noise (better quality and performance) while the value noise is easier to understand. But in both cases octaves are added together n times(the gradient noise doesnt replace this procedure). See:

http://en.m.wikipedia.org/wiki/Value_noise

http://en.m.wikipedia.org/wiki/Gradient_noise

Gradient noise seeds a grid with random vectors of the length 1. These vectors are placed with a distance of 1 to each other. Taking the dotproduct of the displacementvector from the 4 nearest gridpoints to my wanted point and the seeded gradient vectors at these 4 points will then result in a value between -1 and 1 for each of these 4 points. These values can then be interpolated to get the actual points value.

Value noise generates random values in real time for every gridpoint, wich are placed with a distance between them of 1. These values are generated with a seed, wich allowS me to get the same value over and over again. When i pick my square wich surrounds my point i want to get, i generate the random value in realtion to my passed coordinates (the algorithm for such a generator can be seen in the 2nd tut) and then blur it with the surrounding gridpoints to get a smooth noise.

Upvotes: 3

Related Questions