Continuous Perlin Noise

// November 25th, 2008 // Experiments, Source code & tutorials

You probably know the situation. It’s 2 am and you can’t sleep because you’r thinking about the big questions of life:

Why are we here? What are we here for? Can you make seamless Perlin noise tiles?

That last question kept me awake last night. After an hour thinking about using overlapping tiles with blurred edges and blend modes or writing my own Perlin noise, I decided to get back up and give it a try.  But to my surprise, when looking at the api, I found that the smart engineers of adobe already thought of that. The BitmapData perlinnoise method has a “stitch” property. So, no challenges here I guess.

public function perlinNoise(baseX:Number, baseY:Number, numOctaves:uint,randomSeed:int, stitch:Boolean, fractalNoise:Boolean, channelOptions:uint = 7,grayScale:Boolean = false, offsets:Array = null):void

Anyway, here’s an example with the perlin source

AS3 perlin noise

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

6 Responses to “Continuous Perlin Noise”

  1. Ronny says:

    Impressive. Could you however explain the formula you use to get the height?
    Pretty cool! Thought this was done using PV3D for a moment!

  2. Kris says:

    Hi Ronny,
    The height (y offset) is the colour value of the pixel on that position in the Perlin noise (the red value in the example).
    The last line is just to get smoother valleys and pointier peaks.

    var ofset : Number = pval >> 16 & 0xFF;
    var h : Number = ofzet * ofzet * ofzet / (265 * 265)

  3. [...] View the Flash version of the image: Click Read all about it on Kris’ blog: Click [...]

  4. [...] went on the interwebs and started looking for cool stuff. I came along Neuro’s blog and found his Continuous PerlinNoise post. I liked it. So…. i wanted to try it myself and see if i can do the same, maybe even slightly [...]

  5. Choons says:

    ahhhh… I have been looking for a decent example of how to do this for two days. Now I can sleep ; ) Thanks so much for posting it.

  6. Wim Wouters says:

    Don’t we all love perlin noise… and terrain generation… and 3D… well… you know!