Gradient noise hashing.

219 Views Asked by At

I'm working on a gradient noise function based on Simplex noise that uses simple squares instead of triangles (for performance and to avoid the patent for 3D noise).

The original Simplex noise algorithm uses a small 256 entry look-up table for getting the gradient for each of the triangle's corners. When using squares instead of triangles, the noise pattern starts to repeat for coordinates that are multiples of 256.

To solve this problem I came up with the following hash function (completely experimental) which seems to solve the repetition problem:

$$ hash = ((2860486313 * (3367900313 * x \oplus 4093082899 * y)) \gg 32) \& 255 $$

X and y are the integer parts of the noise function's input, and change according to typical use cases of gradient noise functions (texture generation, landscape generation, etc).

Can anyone tell me if this has a period close to, or greater than 2^32? On the surface it seems to be the case, but I have absolutely no clue of how to work out whether or not this is the case (other than brute-force checking).

Note: I've asked this on Stack Overflow because it's programming related, but it seems to be a maths question.