Sculpting Virtual Clay with the Leap

Here’s something fun! @soycamo and I performed at DorkbotPDX’s Open Mic Surgery. She brought the beats, I brought the visuals.

Watch a video of our performance.

I was lucky enough to receive a Leap Motion Controller. It acts like a short-range Kinect for your hands, tracking the position of each individual finger. The Leap’s sensors are fast, and spookily accurate. I love it.

Continue reading

Angel Harp (is the Weirdest Instrument)

It was a joke, back in September. A goofy idea, amidst a brainstorming session of merely silly ideas. It’s a heavenly harp! And when you turn it upside-down, it becomes a Devil Harp! Ha, ha.

The YouTube trailer would probably look something like this:

I hacked Angel Harp together in my spare time. Four long months! The plan was to finish by Halloween of 2011, but it took considerably longer than expected. The synthesis was completed in one week, the sound effects in another week. Standing on the shoulders of Twang, Angel Harp produces somewhat-realistic tones (like an actual harp! Complex filtering!) And it has 3+ dozen strings, for serious plucking power!

And, the graphics… Let’s talk about that.

Once the Halloween deadline became improbable, I decided to hack each feature until it was “good enough.” If any feature became an eyesore, then I’d revisit it — either for version 1.0, or a future release. The clouds were redone a couple times. I had grand plans for the harp itself, using an (awful, buggy) harp modeling tool; in a future version, you can draw your own harps, and skin them with fancy materials, I think.

Angel Harp! Heaven!

Continue reading

Son of Strange Attractors

I rewrote my strange attractor generator, in Flash:

Try it. Click to generate new attractors.

The attractor coefficients are still chosen randomly. But now, attractors that explode/collapse are rejected. Also, attractors that create “boring” shapes (by drawing the same pixels repeatedly) are discarded. It’s a little slow, but I’m sure the speed could be improved using Pixel Bender.

Also, here’s the source code. (Compile with Flash CS5.)

Reconstructing Images With Text

I was inspired by Roger Alsing’s supposed “genetic” image compression. It begs for further experimentation!

Here’s my second batch of image reconstruction using Times New Roman characters. The algorithm is a brute-force affair: New characters are colored & positioned randomly. Any characters that make the canvas look more like the original image are saved. And that’s about it. Oh, and the font sizes start large (5120pt) and end small (10pt), so that fine details have a chance of survival.

monarch_1 monarch_2 monarch_3 monarch_4 monarch_5 monarch_6 monarch_7 monarch_original

mona_original mona_reconstruction
Time lapse of the Mona Lisa reconstruction on YouTube, with silly music.

moth_0 moth_1 moth_2 moth_3 moth_4 moth_5 moth_6 moth_7 moth_original

My first batch uses a different algorithm. Each canvas allocates a certain quantity of letters, and progressively mutates them, trying to mimic the original image as closely as possible. This technique is more akin to image compression. This batch is still in progress, it’s very slow. I’ll post these when they’re ready!

Strange Attractors in Flash

Have you seen (or played) the demo for Polynomial, the space shooter? Quick! Watch the video:

I spent a couple hours generating strange attractors in Flash, just a simple 2D version for now. Click to play:

Here Be Strange Attractors

Click the black region to generate new polynomial coefficients and redraw. You will have to click many times to generate something interesting. That’s the nature of fractals, I’m afraid. Some coefficients are automatically thrown out if the drawing exceeds a certain size. Unfortunately, the inverse is not true: the code isn’t smart enough to trash any drawings that shrink to microscopic size.

I believe that you can stabilize any coefficients by scaling the values of each coefficient, gradually nudging them larger/smaller until the drawing is stable. I’ll try this when I get more time. I’ve been gung-ho on my first proper iPhone app, trying to finish it before Christmas! Stay tuned…

Also, here’s the source code for the strange attractor harness! Enjoy.

8-bit NTSC artifacts using Pixel Bender

By request, here’s a quick ‘n dirty test harness, and sample code, for NTSC artifacts in the style of the 8-bit Nintendo Entertainment System (NES):

Click the animation to change scale & scroll speed.

Source code & .fla: nes_ntsc.zip

The .pbk code is not optimized yet. The code is fairly explicit, I tried to explain how it works in the comments. Blargg’s pages have better explanations tho.

The test harness lets you select two flavors of the effect. The numbers 8 and 12 denote the width of the lowpass window used for applying crosstalk. 12 is more processor-intensive, but will look “smoother”, which may not be what you want. The mathematics can be reduced to a few (long) lines, which should reduce processor overhead; I want to do this in the future. unic0rn left some nice comments suggesting more routes to optimization.

The filter still needs some tuning. Areas of solid (non-black) color have diagonal stripes in them. I believe that normalizing the strengths of the filters will fix this.

To be continued…

Fractal Transform, made with Pixel Bender

I made a Pixel Bender filter that performs Julia Set transformations on images. It looks great when it animates, the colors morph and twist like mathematical slime. Try it (Flash Player 10 required): JuliaTile.swf

Source code: julia_tile_src.zip. Pixel Bender code is in src/shader/.

The default image is Seattle’s Space Needle. You can upload custom images. Very large images may set your processor on fire.

Continue reading