I decided to try using Pixel Bender to do the time displacement in the recent experiments I’ve been doing, as I was hoping it would perform better. It actually seems to, but there still is a significant lag. However, I’m pretty sure this is because of having to make a huge sprite sheet first.
I basically make a huge sprite sheet of all the frames I have saved. Since Flash 10 lets you have bigger bitmaps (16,777,215 pixels total, max dimension at 8,191 src) I can create a large image that tiles all the frames I currently have saved. I can have a max of 12 frames across (at 640) and 4 frames down (at 480). So after I create/update this giant bitmap, I send it to a pixel bender filter that is currently applied to a gray scale image. The Pixel Bender filter then looks at each pixel, evaluates the brightness and interpolates it to what frame it needs to update from, then replaces the current pixel with the appropriate one from the selected frame.
These experiments are still a little rough, but I’ll post ’em anyways. No videos yet, I need to find some time to do screen recordings. The ticker is obviously by Mr. Doob. You’ll need a webcam for all of these, sorry.
- brightness: Displacement based off of brightness of current frame.
- movement: Displacement based off of movement (difference between frames)
- painting: Displacement based off area pained by user, as in previous post (inspired by Smudge City).
- noise: Displacement based off of perlin noise.
- filmstrip: Displacement based off of titled blocks.
In any of these experiments, you can right-click to show the source that is controlling the displacement.
I’ve been playing around with Pixelbender as well lately, but with a different effect/application in mind… Still need to figure out how to improve the fps though. Right now my whole Flash application dropped to something like 4 fps due to the heavy stuff going on. I’ll post something once it’s a bit more solid… Might (maybe, hopefully, fingers crossed) end up being be a pretty big site in the end for a personal project…
Yeah something I’ve noticed is the larger the secondary bitmap, the longer the filter takes to run. Not entirely sure why. The area of the bitmap that the filter is applied to is 640 x 480, but the ‘sprite sheet’ that I am send to pixel bender as a secondary image to use is pretty large. But that theoretically shouldn’t matter, since the filter is only applied to the first source, maybe it’s run over whatever image dimension is larger instead of just the first source. My other theory is that actually sending the bitmapdata itself to pixel bender might be intensive. (I’ve noticed that the filter runs over 100fps when testing in the pixel bender editor).
So if you find anything out, defiantly let me know.
Had the same experience here. The filter in the Pixel Bender Editor is as fast as it can get and then in Flash – while it still runs relatively smoothly – it kinda drags the whole application down noticeably… Will let you know if I find anything. Same for you though: If you find anything out, please make a post and save me some braincells. =)