04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The noise() function is an advanced function based on Perlin noise, developed by Ken<br />

Perlin. Ken Perlin is a professor at NYU’s Media Research Laboratory (within the<br />

Department of Computer Science) who actually won an academy award for his development<br />

of Perlin noise. The problem with using pure r<strong>and</strong>om numbers for generating<br />

textures, motion, or any type of organic effect is the overly even distribution of the r<strong>and</strong>omness.<br />

It’s a paradox, but pure r<strong>and</strong>omness is not quite r<strong>and</strong>om enough in a sense.<br />

Perlin addressed this issue by creating more harmonically structured <strong>and</strong> pleasing noise<br />

that utilizes controllable, semi-r<strong>and</strong>om number generation in combined octaves of varying<br />

frequencies, generating noise patterns that have both high <strong>and</strong> low peaks within the r<strong>and</strong>om<br />

distribution (it sounds complicated because it is). Perlin’s breakthrough allowed for<br />

all kinds of procedural textures <strong>and</strong> fractal-like structures to be developed, including virtual<br />

clouds, oceans, <strong>and</strong> mountains.<br />

There are also two seed functions within the R<strong>and</strong>om section: noiseSeed() <strong>and</strong><br />

r<strong>and</strong>omSeed()—one for each generator. The seed functions, when passed a constant, allow<br />

the generators to produce repeatable r<strong>and</strong>om patterns. For example, when you run the<br />

following sketch, the first loop utilizes a seed to generate a repeating value, while the second<br />

loop generates a r<strong>and</strong>om value each iteration of the loop:<br />

Constants<br />

println("using a seed");<br />

for (int i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!