Seb Lee-Delisle


3D Perlin noise in Flash

OK I admit it, Robert Hodgin got me thinking about Perlin noise. I thought it was just a nice swirly effect. Which of course it is. But it can be more than that! What if you have a particle and change its direction depending on the value of the noise? You have a nice smooth analogue movement. And what if you put a whole bunch of particles together? You get flocking that’s what!

Except of course Robert only uses Processing these days. But surely with AS3 we can do some of this stuff? Surely! So I’m now on a mission to find out.

OK so step one. Robert’s Perlin noise was all swirly and animated. But our standard Flash Perlin noise is only static. Why is that? It’s because Flash’s built-in Perlin noise is 2D. How do you make 2D Perlin noise all swooshy and lovely?

Well you actually make 3D Perlin noise and take slices along the z axis. Kind of like a brain scan. You have a big 3D blob of noise and you just take thin slices and look at each one. Each slice only changes a little so it looks like it animates all nicely! Yay!

So the built in Flash Perlin noise is no good. So let’s look at Ken Perlin’s original noise algorithm. Wow. It looks good. But I haven’t programmed in C for about 10 years and my brain hurts.

But thankfully this nice chap Ron Valstar has just converted it into AS3!

And all the parts have come together to be able to make animated Perlin noise. So here it is :

I feel like this is the start of something big...

[UPDATE] See part 2 - Animated Perlin Clouds in Papervision3D

This entry was posted in Actionscript, Flash, Flash Physics, Obsolete. Bookmark the permalink.

17 Responses to 3D Perlin noise in Flash