Search code examples
iosgpuimage

Passing previous frame result as input to next frame


All the examples take an image and turn it into something else in one frame, but what if I want to create something like motion blur that requires feedback? That requires combining the results for current video frame with the filter result for the previous frame. How do I efficiently store the previous frame result so I can use it in the next frame as input?

enter image description here

I have tried reading various example shaders included in FilterShowCase and read the sunlakesoftware.com introduction to GPUImage. I noticed GPUImage comes with a GPUImageTextureOutput and GPUImageTextureInput, but what I need to do seems to require using the same texture as both input AND output.


Solution

  • Got this to work. Turns what I thought to be "motion blur" is actually the low pass filter effect.

    GPUImageLowPassFilter has code that deals with taking current and previous frame and mixing them with GPUImageDissolveBlendFilter, doing exactly that.