Output range of Perlin noise

后端 未结 2 1924
后悔当初
后悔当初 2020-12-19 02:03

I\'m investigating a few of the various implementations for coherent noise (I know there are libraries, but this is mostly for my own edification and curiosity) and how you

2条回答
  •  既然无缘
    2020-12-19 02:35

    When you calculate dot product, you may get values outside -1 +1 range, however during interpolation step, final value falls in -1 +1 range. This is because distance vectors of dots products that are interpolated point into opposite directions of interpolated axis. During the last interpolation output will not exceed -1 +1 range.

    Final output range for Perlin noise is defined by length of gradient vectors. If we talk about 2D noise and our goal to have output range -1 +1, the length of the gradient vectors should be sqrt(2) (~1,4142). It is common mistake to mix these vectors (1, 1) (-1, 1) (1, -1) (-1, -1) and (1, 0) (0, 1) (-1, 0) (0, -1). In this case final output range still will be -1 +1 range, however the values in range -0.707 +0.707 will be more frequent. To avoid this problem (1, 0) (0, 1) (-1, 0) (0, -1) vectors should be replaced with (sqrt(2), 0) (0, sqrt(2)) (-sqrt(2), 0) (0, -sqrt(2)).

提交回复
热议问题