Actually I managed to convert the right areas, but now I gues my question is more about setting up a feedback loop in after effects so that the effect can accumulate. Is this a possibility or should I be doing it another way? This is the code that I ended up with:
input image4 src;
input image4 feedback;
output pixel4 dst;
parameter float slide_up;
parameter float slide_down;
float4 su, sd, amount, up, down;
// sample inputs at texcoords
float4 input0 = sampleNearest(src, outCoord());
float4 input1 = sampleNearest(feedback, outCoord());
// get contribution
amount.x = input0.x > input1.x ? 1.0 : 0.0;
amount.y = input0.y > input1.y ? 1.0 : 0.0;
amount.z = input0.z > input1.z ? 1.0 : 0.0;
amount.w = input0.w > input1.w ? 1.0 : 0.0;
// calculate slide down
float d = max(1.0, abs(slide_down));
sd = float4(1.0 / d);
down = input1 + ((input0 - input1) * sd);
// calculate slide up
float u = max(1.0, abs(slide_up));
su = float4(1.0 / u);
up = input1 + ((input0 - input1) * su);
// mix between down and up
dst = mix(down, up, amount);
I'm not sure I understand. Do you need to accumulate the result across frames?
Yes, that's a bit how it works. Here is an example: http://vimeo.com/8360810 and http://www.youtube.com/watch?v=enaEdyw5J24&feature=player_detailpage#t=209s ..the sort of trails that come off of the floating pieces (those are real, not generated particles)
I know I could do it with particles/motion masks/thresholding, but this seems like a simple enough way, or it usually is in Jitter
Do you have a quartz composer project that does what you want? Would you send it to me?
I tried a while ago to get the shader to work fully in quartz because I couldn't figure out how to properly do a feedback loop with the GLSL object. I tried putting it in a render in image, but that didn't quite work.
I guess my question is how to do a sort of running average of frames, but with a sort of luminance theshold and the ability to control how much feedback there is/how long the trails are. She pbk works in AE but I guess without a way to give it the proper frames, it might not work correctly.
Maybe one idea is to give it the first video, then give it a second comp source with the frames offset by one from the original or something...no..that doesn't seem right, but just an idea
Ah...I guess "Echo" is pretty close to what I'm thinking actually...maybe there is a way to adapt something like that? Probably not a way to open that in the pixel bender language though...
There's no way (at least that I'm aware of) to do what you want currently in Pixel Bender, if my understanding of your request is correct. We don't provide a way to do recursion or loops within graphs nor do we provide a way to persist data across frames short of storing the data out as part of an image and then sampling the data again in another invocation of the filter. You can fake recursion of a limited depth via graphs. I believe I posted on that sometime back so look through the recent posts if you're interested. It's also possible that there is a way to use other After Effects functionality in combination with Pixel Bender to achieve the desired result. You might ask out on the AE forums to see if you get any suggestions there. I apologize if I've misunderstood your request entirely.
Where can I find "echo?" It doesn't appear to be part of the Quartz Composer patch library.
BTW, you certainly can convert many GLSL filters, including those intended for use within Quartz Composer, to Pixel Bender. I've converted a number of them for private use so don't give up on this possibility when it comes to other filters.