Just Completed My Perlin Noise (?) Function!

Hey guys!

I just spend ~7 hours researching and coding a perlin noise function in Unity (It’s 5am here, yay!).

I am still, however, a relative newbie at this kind of stuff. In fact, I’m not even entirely sure it is perlin noise.

With that said, I would greatly appreciate it if one of you fellow programmers took the time to analyze/criticize my code. Let me know: Is it “technically” perlin noise? Are there any major optimizations I could make to it? I know I didn’t implement a frequency/amplitude variable. Does anyone know how I should implement that?

Lastly, I plan on using this to generate random terrain levels for my game. I need to make the “edges” of the texture black to represent water, like an ocean with an island-ish region in it. Does anyone have any tips regarding the implementation of this i.e., where to start :P?

Thanks guys!

short answer: NO

I think its a far stretch to call this Perlin noise, in theory everything can be called 1 octave Perlin noise. What you got there is blended white noise. The concept of perlin is to combine noise from several octaves(layers) so to use an octave count of 1 defeats the concept of Perlin. Also Perlin noise revolves around the concept that if you ever re-calculated the Perlin noise you would get the same output. Your code is truly random, and such you wont get the same result multiple times.

May I suggest you read this excellent illustrated text on Perlin Noise. Notice how each octave have a different amplitude(height) and frequency(resolution). Its not the raw Perlin implementation, but its much easier to grasp, and it does show what makes Perlin Noise special.
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Cheers,
Unlogick

long answer:

here is the original paper from Mr. Perlin :slight_smile:
http://mrl.nyu.edu/~perlin/noise/

or a port version for unity :stuck_out_tongue:
http://forum.unity3d.com/threads/33725-Perlin-noise-procedural-shader

Also, the procedural examples have a Perlin noise function.
I also did some noise shader before (not nearly as good as apple_motion’s :slight_smile: ). I don’t remember if it was Perlin though.

me too, I did not know that was called perlin until I finished the demo :stuck_out_tongue:

that’s why I love to post my demo or test in here or youtube, because each time I posted something, I found someone did better than me, and that make me understand more more :slight_smile:

Hey guys, thanks for all the feedback. I love our community here!

I will definity look into the links you guys posted and improve my concept.