Simplex noise

https://github.com/ashima/webgl-noise/blob/master/src/noise2D.glsl

First corner

Other corners

var i1: vec2 = null

i1.x = step( x0.y, x0.x ) // x0.x > x0.y ? 1.0 : 0.0

i1.y = 1.0 - i1.x

x0 = x0 - 0.0 + 0.0 * C.xx

x1 = x0 - i1 + 1.0 * C.xx

x2 = x0 - 1.0 + 2.0 * C.xx

Permutations

Gradients: 41 points uniformly over a line, mapped onto a diamond.

The ring size 1717 = 289 is close to a multiple of 41 (417 = 287)

Normalise gradients implicitly by scaling m

Approximation of: m = inversesqrt( a0a0 + h*h )

Compute final noise value at P