I've been playing a lot with Flash 8's bitmap features in conjunction with webcams, and will be releasing a few of the resultant experiments over the next week or so. The first of them is pretty simple, though it took some tweaking to get right.

This experiment simulates a snowfall with 400 snowflakes on screen, each with random size, rotation, speed and blur (using BlurFilter). Each of them is independently affected by wind (as partially controlled by your cursor's x position). That Flash can run it all fluidly is impressive in itself, but of course there's more. It's also monitoring the webcam input, detecting edges, and making the snowflakes settle gently on any horizontal surface they encounter - pretty cool.

I'm achieving this with a combination of convolution, horizontal blurring, color adjustments, thresholding and pixel sampling. It's relatively processor intensive with 400 flakes, but it runs at the full 30 fps on my G5.

You can see the experiment below. If you don't have a webcam, you can still see the snowfall, and I've appended a picture of it in action below. If you do, try playing around with it - one of the neatest things I think is to let some snow pile up on your head or shoulders and then brush it off with your hand... virtual dandruff! Note that it obviously works best with adequate lighting, and good contrast (ie. your white shirt against a white wall won't gather any snow).

Requires Flash Player 8. If the snow isn't sticking to edges, you probably have an older player.




Also check out Gallery Incomplet (incomplet.org) for other Flash experiments.

Here's a sample image for those of you without webcams:

Another image, I just liked the way the snow piled up on the graphics on this shirt: