I'm trying to create a perlin / simplex / value noise function in JavaScript that will give results similar to the following:
(Note: this image has already had a treshold applied. I want it without the treshold.)
I've been looking all over the internet for 2 days now. There are plenty of links explaining noise and a lot of code, but none in JavaScript, and whenever I try to convert it, I get weird results. Here are some of my attemps:
- http://jsfiddle.net/GZCye/
- http://jsfiddle.net/Lk56f/ (based on this)
- http://pastebin.com/nMA40SrL (doesn't run in Fiddle for some reason, based on this
I think part of the problem might stem from the use of the bitwise operators in JavaScript, where it is difficult to enforce the type of a number.
What I'm looking for is an example of working, JavaScript noise (whatever type).
I'd also be willing to grant a bounty for any information pertaining to the parameters that could lead to a pattern similar to the image I posted (before threshold) or any optimization tips since I'll need this to run as fast as possible (in JavaScript nonetheless).
I came up with this solution which gave better results for my use case:
http://asserttrue.blogspot.com/2011/12/perlin-noise-in-javascript_31.html
It's using a big permutation matrix:
Use it as: