yesterday UP (by pixar) was released in France and we saw it with my best half.
for a while now I wanted to create procedural clouds.
don’t ask me why, there are things like this…
so the most common way to do so is to use a Perlin Noise. although I had read lots of esoteric things about procedural noise and Perlin noises especially, I never found the agorithm before.
so here you go with Ken Perlin’s noise:
+ some interseting resources I found about the topic:
- http://freespace.virgin.net/hugo.elias/models/m_perlin.htm < great
- http://mrl.nyu.edu/~perlin/
- http://www.mandelbrot-dazibao.com/Perlin/Perlin1.htm
As the PerlinNooise is one of the default methods of BitmapData, I guess it is performed somewhere on the graphics card.
my implementation is far too expensive and barely has a learning purpose value but it’s fun… at least I love it :)
for fast and clean result, you should try out nutsu‘s Frocessing take on PerlinNoise
click on the ‘reseed’ button to reset the noise:
then:
- animate: will animate the cloud namely incrementing the perlinZ value of Perlin class
- frequency:determines the ‘size’ of the noise, the smaller the frequency, the bigger the waves.
- amplitude:is some kind of ‘multiplier’ for the brightness
- persistence:determines how much of the porevious octave is kept when merging the layers
- octaves:determines the amount of layers (influences the complexity of the final noise)
I strongly recommend you not to run the animate mode with more than 1 octave.
the size of the bitmapData is rather small (120*60 +/-) then it’s strectched by 4, otherwise it would just crash :)
you’ll get the sources here: perlin.zip it contains the PerlinNoise.as that has a static
PerlinNoise.compute( x, y, z );
method that returns a Number comprised between 0 and 1 depending on the frequency/amplitude/octaves/persistence and is used to set each pixel of the final picture.
yeah and with a big resolution, it does look like clouds :)
my beloved readers wrote…