Calculate frame difference using shader

    Apr 11 2008 | 11:03 am
    Hi all,
    Any idea on using shader, e.g., to do frame difference without providing the last frame explicitly ? In another word, how may I store the old frame in texture, while receiving the new frame stream only ?

    • Apr 11 2008 | 5:20 pm
      you can take a look at wes's accum shader (which mimics the erase_color functionality in a shader). linked here:
      it uses the previous frames texture in it's calculations.
    • Apr 14 2008 | 10:27 am
      Hi Rob,
      Thanks for post.
      I did almost the same way to calculate the frame difference. However, I want to have a speed boost by avoid the external transfer of a left texture to right.
      Take a look of Wes' patch
      What I want is like this,
      Is it possible ?
      yours, William
    • Apr 14 2008 | 5:58 pm
      Quote: williamshome wrote on Mon, 14 April 2008 04:27 ---------------------------------------------------- > > Is it possible ?
      not that i'm aware of, but i'm not a shader expert. i believe that's the nature of shaders, each pass only deals with the the pixel or vertex values at that moment in time. this is why they perform so fast. i don't really think passing the one texture will slow you down that much.
      might be a better question for a glsl forum, but perhaps others know more.
    • Apr 15 2008 | 10:40 am
      I believe it is possible but we just do not understand how it works.
      Would it be similar as writing back some data to the texture ? It has been mentioned by GPGPU ppl. Any glsl expert can help ?