Based on http://www.arendpeter.com/Perlin_Noise.html