So, yesterday while I was in bed, I couldn’t fall asleep. So I figured out the way that the S-curve works, and I played with it a little while today. I managed to make my perlin noise work! It would need some improvement though. I’m still using java.Random class. If I wasn’t using it, maybe performance would improve. What I have done differently from my first attempt, is now I generate random direction values that are length of 1. Also, I swapped the interpolation values a little. First, I calculate interpolated value between SV and TU using xd00.y as my weight. Then I interpolate based on xd00.x weight. This magically worked, but I don’t know why, but my noise looks kinda crappy. Not in sense of quality, but Simplex Noise looks a lot better for some reason. Anyway, here is the code. If there is some kind of expert here, please do tell if this is actually Perlin’s Noise correct algorithm.
It is pretty long code… Thought I better put in to pastebin, because it was pretty hard to read in post.
http://pastebin.java-gaming.org/3b0691d8474
I documented this code a little bit. I followed this tutorial to make it. Read it, because I think code is confusing for someone who doesn’t know what is going on.
http://webstaff.itn.liu.se/~stegu/TNM022-2005/perlinnoiselinks/perlin-noise-math-faq.html#algorithm
Here are some images generated using the code above.
Low frequency.
High frequency.
High frequency, high contrast.
I would really like for someone to explain to me how to generate random numbers from -1 to 1 for x, y based on some kind of random seed. I think it would speed up the algorithm even further.
RANDOM STUFF BELOW WHY DID I PUT IT THERE.
Random random = new Random();
Link randomLink = random.nextLink();
randomLink = http://www.twitch.tv/notch/b/302867302
Lol I love to watch Notch coding. <3 that keyboard sound.