Calculate frame difference using shader

Apr 11, 2008 at 11:03am

Calculate frame difference using shader

Hi all,

Any idea on using shader, e.g. jit.gl.slab, 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 ?

William

#36864
Apr 11, 2008 at 5:20pm

you can take a look at wes’s accum shader (which mimics the erase_color functionality in a shader).
linked here:

http://www.cycling74.com/pipermail/jitter/2008-March/014225.html

it uses the previous frames texture in it’s calculations.

-rob

#126883
Apr 14, 2008 at 10:27am

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

#P window setfont “Sans Serif” 9.;
#P flonum 261 353 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 261 373 137 9109513 param erase_color 0 0 0 $1;
#P newex 131 467 74 9109513 jit.gl.slab test;
#P newex 101 426 162 9109513 jit.gl.slab test @file co.accum.jxs;
#P window linecount 2;
#P newex 101 506 275 9109513 jit.gl.videoplane test @transform_reset 2 @depth_enable 0 @blend_enable 1 @blend_mode 6 1 @position -0.1 -0.1 0;
#P window linecount 1;
#P newex 101 374 41 9109513 r draw;
#P newex 101 397 213 9109513 jit.gl.texture test @name c1 @dim 1024 768;
#P connect 4 0 3 1;
#P connect 3 0 2 0;
#P connect 3 0 4 0;
#P connect 6 0 5 0;
#P connect 0 0 3 0;
#P connect 5 0 3 0;
#P connect 1 0 0 0;
#P window clipboard copycount 7;

What I want is like this,

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 59 155 162 9109513 jit.gl.slab test @file co.accum.jxs;
#P window linecount 2;
#P newex 59 235 275 9109513 jit.gl.videoplane test @transform_reset 2 @depth_enable 0 @blend_enable 1 @blend_mode 6 1 @position -0.1 -0.1 0;
#P window linecount 1;
#P newex 59 103 41 9109513 r draw;
#P newex 59 126 213 9109513 jit.gl.texture test @name c1 @dim 1024 768;
#P flonum 219 82 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 219 102 137 9109513 param erase_color 0 0 0 $1;
#P connect 0 0 5 0;
#P connect 1 0 0 0;
#P connect 5 0 4 0;
#P connect 3 0 2 0;
#P connect 2 0 5 0;
#P window clipboard copycount 6;

Is it possible ?

yours,
William

#126884
Apr 14, 2008 at 5:58pm

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.

#126885
Apr 15, 2008 at 10:40am

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 ?

#126886

You must be logged in to reply to this topic.