However, it ends up producing a weird pattern which is pretty far off the result I was looking for. The image it creates is below.
I tried messing around with the noise function and dot product function, but I'm unsure of what is actually going wrong. I suspect that I've made a silly error with the logic behind it, so if one of you could point that out for me then that would be greatly appreciated.