New in AU Library: Field masking

maskedAUMultiFieldIn the AU Library (currently in beta – see earlier posts for download links) you can store an RGB image in an object called an AUMultiField, where you can do lots of things to do it, including drawing it on the screen.

Now you can also draw it using a mask. Create any AUField with shades of gray, and tell the library to use this as a mask when you draw your picture. Values of the mask from 0 to 1 control the opacity of the corresponding pixels, from fully transparent to fully opaque. In other words, the mask is an alpha layer, but it’s better than Processing’s built-in alpha because the values are stored in floats, giving them much more range and precision. The layer is also separate from the pixels, making it easier and faster to modify.
Continue reading

The Joy of Easy Motion Blur

A frame with and without motion blur

Motion blur on the left, no motion blur on the right

Any time I make an animation where things are moving quickly on the screen, I think about adding motion blur to my sketch. We’re used to seeing a trail behind fast-moving objects when watching film or video, and when we don’t see it the animation can feel jerky or just vaguely “wrong” (for more discussion, with examples, see Imaginary Institute Technical Note #7, “Fields and Cameras,” available here). Sometimes I’ve bothered to invest the time to write motion blur code yet again, sometimes I haven’t.

In my AU Library (now available in beta through this post), I’ve implemented a high-quality camera model that is super-easy to use (though it has lots of options for advanced users). One of its built-in features is motion blur. I wrote a little animation yesterday, and thought I’d add motion blur. I included the library and added three trivial lines, and it was done! Less than a minute of work and I had fully motion-blurred results that look great. After the break you can watch the animation with and without motion blur. Continue reading

AU Library for Processing: The Beta Release!

AUBeta-logo-226-225Huzzah! After a seemingly endless gestation period, my Processing library is ready for its beta release!

You can download the file here. Install it into your Processing setup in the usual way (that is, unzip the file and place the results into the libraries folder of your Processing installation. You can find lots of walkthroughs for this procedure online; a nice one can be found here.

The AU library (AU stands for “Andrew’s Utilities”) contains 12 distinct sections, each intended to help you write shorter, cleaner, and more bug-free programs. The sections range from very simple (a single routine to flip a coin) to very powerful (generating equally-spaced points on multi-segment curves). The library is thoroughly documented with motivation, explanations, lots of pictures, and lots of complete examples with source code.

This beta release is meant to be a shakedown cruise. I’d love to have lots of people use this and help me make it even better before I formally release it.

Follow the break for a summary of the library’s contents. Continue reading

Efficiently Finding Points on Catmull-Rom and Bezier Curves

In my AU library, I offer some utilities related to curves. Although Processing offers functions for finding points on curves, I needed to write my own implementation that was fast and efficient. Here’s an easy, elegant way to compute points on Catmull-Rom and Bezier curves, along with a discussion of an idea for making it faster. Continue reading

Noise Blending for More Exciting Animation

noisefieldWe often use Perlin-esque noise functions to create complex graphics (the noise function built into Processing is just such as function). We can save a value of noise at every pixel in our graphics window, creating a field of noise. The value of these fields is that, unlike white noise, these fields contain visible structure at multiple scales, and that structure usually creates interesting graphics. But when we animate these images they often seem to be missing a certain oomph. This note discusses one way to get that excitement back in there! Continue reading

Work In Progress

nomads350I’ve been making little doodles with my new Processing library. The goal is to make it better by finding and fixing bugs, and making it easier to use overall. Here’s something I made this morning roughly based on an earlier sketch. It uses my 2D array to store multiple noise images, my animation controller to sequence the noise fields, and my camera to make motion-blurred final frames. Click the picture to see the animation!

Making A Processing Library

AUlogoWhile programming in Processing, I’ve developed about a dozen useful tools for everyday work. I’ve packaged these up in a library which I call AU, for “Andrew’s Utilities.” I’ll be sharing it as soon as I finish the documentation. Although the official Processing wiki has a nice walkthrough for how to make a library, there are a few things that I spent considerable time figuring out. Here’s what I learned, to save you the effort.
Continue reading