Clones / lightpainting using delay frame

Hi! I can’t get my head around something: I’m trying to create an effect replicating the echo effect in after effects. Meaning clones overlayed with a min blending mode. craig lewis has a light paint loop filter that is pretty much what i’d like to achieve but I’d like mine to have larger intervals and no fading.

For the moment I created groups with a bunch of interlinked delay frames to create a. 0.5s delay, I connected them together with some blending nodes and I can achieve the effect wanted but im limited to 8 clones. I have a feeling there is a much simpler solution, that must be similar to the technique used for lightpainting, but I just don’t get it. can any one help?


you mean like this?

if you want longer decay of the fade simply drop the alpha in mix value to as small as possible but still greater than 0. if you set it to 0, then it anything brighter will always be on top permanently until every pixel gets white (white is the maximum)


also if you want to get some interval between them then you can stack delay frames, and after it reaches the fragment limit 9, simply pass it through a shader render pass again to reset the count

1 Like

1 Like


I think that’s exactly what I was trying to figure out! I’ll try it out.
thank you so much for your help!

Here’s another example that uses our frame cache scripts. I think it’s behaving the exact same way as Craig’s effect. The solution ended up being really compact, but it took me a while to wrap my head around how to manage it.


My God, frame control is one of the most complicated topics in Spark AR

In one way, you lose the quality of the frame, in another way, the frames come out of the freeze mode, and in another way, the effect has a drop in fps.

It took me a few months to get a handle on the frames In my opinion, the frame catch project can also help, because it uses a render pass, so it has high speed and quality Of course, I don’t have this project and I’m not familiar with how it works, but its description shows that it can help you

true, it would be more expensive the more frames you store in the grid, to compensate would be to be by downsampling but that would degrade the texture, so it really becomes a balancing act between quality and performance. it’s a super valuable tools to have.

here is another use case of the super amazing frame cache on sugar.
it helps me to generate a lenticular effect. so the animation sequence are played based on viewing angle.
the basic comes down to interpolating texture a and texture b by viewing angle, to create animation, simply do this for how many textures you have divided by the range of viewing angle you desire

here is a preview of how it looks on the device:

My effect is slowly getting there!
When the effect starts it flashes with a black frame, I added a delay and a reset button to circumvent that issue. But now I also added a slider to control the delay time between the frames and this flashing black frame appears again, where does it come from and is there another way of getting rid of it?

@josh_beckwith is it possible to recreate this effect using frame cache? freeze the frame instead of having a delayed clone


I think the black frame is probably coming from the delay frame background color.

Is the effect @55s in the demo what you need? frame-cache-demo-v2 on Vimeo

I ended up using frame cache following your example, it was way cleaner and less buggy than using a bunch of delay frames :slight_smile: the black frame thing still happens but I added a delay and that did the trick.

Sorry my question wasn’t clear, what I was referring to would be for a totally different filter, trying to recreate something like this:
is there a way to store freeze frames in frame cache?

Sure, you can do that by incrementing the index slowly with a counter, then using the normal frame stack method to put all of the frames together.

One small detail is that the frame stack uses solid black for some reason, but you can change it by swapping out this line: vec4 stack = vec4(0., 0., 0., 1.);

to this vec4 stack = vec4(0., 0., 0., 0.);


Thank you josh! that’s exactly what I wanted to achieve :grinning:

1 Like