Closed bsurmanski closed 2 years ago
After further reading and consultation of the implementation of Perlin noise on p74-77 of Texturing and Modeling, a Procedural Approach, I believe the real issue is the 'gradient_dot_v' functions don't actually do a dot product. furthermore, the implementation used (assuming gradient_dot_v is implemented correctly) will skew the gradients towards the square diagonals and won't allow the gradients to be close to unit length away from the diagonals (since we are mapping a random vector on a square to a random vector on a circle with a fixed scale factor and not normalization).
I'm going to take another look for a way to do this. Ideally, the permutationtable would return a normalized vector as per Texturing and Modeling
. Maybe a new permutation table type would be preferable.
Hmm, nevermind. I see now that you are using Perlin's Improved noise and the gradients are intentional.
Builds off branch feature/1dperlin, since I added a test for 1d perlin too.
Each SCALE_FACTORs in the code seemed to be incorrect. Unscaled, each function would return between [-0.5, 0.5]. So in each dimension the scale factor should be the same: 2. I added unit tests to support this.