Search Unity

Need Help With Perlin Noise

Discussion in 'Scripting' started by NinjaSquirrel117, Dec 20, 2011.

  1. NinjaSquirrel117

    NinjaSquirrel117

    Joined:
    Dec 28, 2010
    Posts:
    27
    So I've been trying to make perlin noise but I've got some questions regarding it:

    First could I be confirmed that my concept on it is right? From what I understand and please correct me if I'm wrong, you create an image. After that you iterate through each pixel and assign it a random color value. Now you have pure noise. Then you go back through each pixel and take the average of the surrounding pixels which smooths it out. Making this. Here is where I'm stuck because I'm pretty sure I need to interpolate or something. Articles such as this say for each octave call the function again. However if I do that all it will do is just smooth the texture out more and more. I read that usually you use 8 octaves so here is my outcome from using 8 octaves in a since that I'm just calling the function again like in the article. Obviously it isn't noisy enough to really be used as anything unless you want something really subtle.

    Now my logic is telling me that the texture looks that way because I'm not interpolating the pixels like in the pseudo code I linked in the article. This brings me to another question: why interpolate 2D noise? I understand with one 1D noise, it smooths out the value creating a curved line instead of a harsh liner one. But with 2D there is no line it's just a bunch of pixels plus I'm already smoothing the texture out by averaging the neighboring pixels like explained before so why do it again?

    Also I'm not doing anything with persistence, amplitude or frequency because implementing that into my code screws something up and with 1 octave nothing happens but with more I get a plain black texture.

    Short Version: Why interpolate 2D nose and how can I implement these methods and variables into my script to create a nice cloudy noise texture?

    My script is found here.

    Anything is welcome but please don't just post your whole script usually when people do that they turn out out to be 5 times more complex and just add to my confusion.

    Thanks!
     
  2. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    Haven't done noise myself in ages so can't help but I recommend looking at some of the more artistic programming orientated sites like Processing or VVVV, they probably have heaps of great examples or procedural noise/chaos.