[PD] need help with gem and glsl feedback

Cyrille Henry ch at chnry.net
Wed Oct 2 22:11:43 CEST 2013


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 at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list