I am looking to adapt Perlin's 3D noise algorithm to lower dimensions, but I am having problems with the gradient function as I do not fully understand the reasoning.
The original Perlin gradient function takes four arguments: a hash and a three-dimensional coordinate (x, y, z) . The result of the function is returned based on the value of hash mod 16 , as follows.
0 : x + y1 : -x + y2 : x - y3 : -x - y4 : x + z5 : -x + z6 : x - z7 : -x - z8 : y + z9 : -y + z10 : y - z11 : -y - z12 : y + x13 : -y + z14 : y - x15 : -y - z
Return values from 0 to 11 create a kind of pattern, since each combination is presented once. However, the last four are duplicates. Why were they chosen to match the last four returned values? And what would be the similar cases with two (x, y) and one size (x) ?
Matthew piziak
source share