Perlin noise not working

Hey there, i recently wrote a perlin noise class following this tutorial - http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

http://pastebin.com/fnjCpTrc – Here is my code. However, I noticed that it doesn’t produce the colours I want, and instead gives me this --> https://dl.dropbox.com/u/13907487/perlin_noise.png

Which means I obviously did something wrong. The thing is, I don’t know what I did wrong. I’m guessing it’s at image.setRGB(x,y, (int)generatePerlinNoise(x,y)) but i’m not sure how to correct it show it shows up like proper perlin noise.

Skim this page: http://www.java-gaming.org/topics/noise-bandpassed-white/27071/view.html. Then look at philfrei’s tool and the link to Stefan Gustavson’s java source and work from there.

Aparently I was using the same or a closely related tutorial. I’m too lazy to read your code (sorry) but if you want you can compare it to my version which is working (no guarantees …)

http://sourceforge.net/p/sunlands/code/21/tree/trunk/src/villagers/utils/PerlinNoise.java

Well you can just use mine if it’s good enough for your needs. It’s GPLv2.

Edit: I was testing two noise sources, one very similar to your code, and another based on an Xor-Shift RNG. Both seem to work sufficiently well. Just to explain why there are two in the code and one is unused currently.

These are “value-noise” variants and using trig functions makes it crazy/insane expensive. Move to simplex noise…I promise it’s a good thing.

Yes. Totally Agree!