Hello list ,
i'm currently trying to understand a bit more glsl , and am tearing my hairs
i have a scene with some moving geometry (torus) on this geometry i use successfully a simple shader to plot a moving circle.
Then i try to make the classical feedback effect , but i need to use glsl because i want to control precisely the adding of the image at time and at time+1
uniform sampler2D tex1,tex2; uniform float motionblurstrenght; vec2 coord = gl_TexCoord[0].st; void main() { vec4 t1 = texture(tex1, coord);//new frame vec4 t2 = texture(tex2, coord);//acumulated frame gl_FragColor = vec4(t1.r); float r = ((1.-motionblurstrenght)*t2.r) + (t1.r);//motion blur gl_FragColor = vec4(r); }
do you have a clean example or hints on how to implement this ? i am currently fighting with gemframebuffer and pix_texture and rendering order and texunits . and i feel i'm missing something ..
i would like , if possible to keep this as an effect i can turn on and off , without modifing my current gem chains .
i think i need two gem chains ,one early and one at last in the frame drawing chronology , but i can't make it though i tried a lot
any help appreciated .
Pierre-Yves
hello,
i think there is a game of life example in gem example/glsl folder. this example show how to make a simple feedback. you don"t need to modifie the rendering, since you juste nead a redback after the rendering. but readback are ineficient.
example 07.framebuffer_and_shader show how to use 2 framebufer in order to use 1 to render the 2nd one. this can be use to do efficient motion blur, or whatever shader you want. but you have to modifie the rendering part : replacing gemhead by abstraction that render in the same framebufer.
cheers c
Le 03/10/2013 02:10, Py Fave a écrit :
Hello list ,
i'm currently trying to understand a bit more glsl , and am tearing my hairs
i have a scene with some moving geometry (torus) on this geometry i use successfully a simple shader to plot a moving circle.
Then i try to make the classical feedback effect , but i need to use glsl because i want to control precisely the adding of the image at time and at time+1
here is the feedback shader i try to use .
uniform sampler2D tex1,tex2; uniform float motionblurstrenght; vec2 coord = gl_TexCoord[0].st; void main() { vec4 t1 = texture(tex1, coord);//new frame vec4 t2 = texture(tex2, coord);//acumulated frame gl_FragColor = vec4(t1.r); float r = ((1.-motionblurstrenght)*t2.r) + (t1.r);//motion blur gl_FragColor = vec4(r); }
do you have a clean example or hints on how to implement this ? i am currently fighting with gemframebuffer and pix_texture and rendering order and texunits . and i feel i'm missing something ..
i would like , if possible to keep this as an effect i can turn on and off , without modifing my current gem chains .
i think i need two gem chains ,one early and one at last in the frame drawing chronology , but i can't make it though i tried a lot
any help appreciated .
Pierre-Yves
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 02/10/2013 20:10, Py Fave a écrit :
Hello list ,
i'm currently trying to understand a bit more glsl , and am tearing my hairs
i have a scene with some moving geometry (torus) on this geometry i use successfully a simple shader to plot a moving circle.
Then i try to make the classical feedback effect , but i need to use glsl because i want to control precisely the adding of the image at time and at time+1
here is the feedback shader i try to use .
uniform sampler2D tex1,tex2; uniform float motionblurstrenght; vec2 coord = gl_TexCoord[0].st; void main() { vec4 t1 = texture(tex1, coord);//new frame vec4 t2 = texture(tex2, coord);//acumulated frame gl_FragColor = vec4(t1.r); float r = ((1.-motionblurstrenght)*t2.r) + (t1.r);//motion blur gl_FragColor = vec4(r); }
do you have a clean example or hints on how to implement this ? i am currently fighting with gemframebuffer and pix_texture and rendering order and texunits . and i feel i'm missing something ..
i would like , if possible to keep this as an effect i can turn on and off , without modifing my current gem chains .
i think i need two gem chains ,one early and one at last in the frame drawing chronology , but i can't make it though i tried a lot
any help appreciated .
Pierre-Yves
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This example could help, see attached. ++
Jack
first thanks both for your help. i was tired yesterday evening.
jack , i have a problem with your patch. i had already similar problems before, that's why i wanted to use some shader in the feedback chain .
it works ok BUT with very long feedback ( 0.999 alpha ) values i get a ghost image, the point never diseappears( because perhaps of a bad approximation in opengl ) . ie : color 1 1 1 0.995 leaves traces is that a problem with my graphics card ? i don't think so . i join a clumsy correction test , with makes things flicker a bit too much . do you have a better workaround?
2013/10/2 Jack jack@rybn.org:
Le 02/10/2013 20:10, Py Fave a écrit :
Hello list ,
i'm currently trying to understand a bit more glsl , and am tearing my hairs
i have a scene with some moving geometry (torus) on this geometry i use successfully a simple shader to plot a moving circle.
Then i try to make the classical feedback effect , but i need to use glsl because i want to control precisely the adding of the image at time and at time+1
here is the feedback shader i try to use .
uniform sampler2D tex1,tex2; uniform float motionblurstrenght; vec2 coord = gl_TexCoord[0].st; void main() { vec4 t1 = texture(tex1, coord);//new frame vec4 t2 = texture(tex2, coord);//acumulated frame gl_FragColor = vec4(t1.r); float r = ((1.-motionblurstrenght)*t2.r) + (t1.r);//motion blur gl_FragColor = vec4(r); }
do you have a clean example or hints on how to implement this ? i am currently fighting with gemframebuffer and pix_texture and rendering order and texunits . and i feel i'm missing something ..
i would like , if possible to keep this as an effect i can turn on and off , without modifing my current gem chains .
i think i need two gem chains ,one early and one at last in the frame drawing chronology , but i can't make it though i tried a lot
any help appreciated .
Pierre-Yves
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This example could help, see attached. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list