[PD] [Gem] Modifying single pixel of pix image

Christof Ressi christof.ressi at gmx.at
Sun Apr 9 10:33:47 CEST 2017


> But do I need even framebuffer ping-ponging
> when I only _add_ to the framebuffer?

you don't need it - but only if the framebuffer doesn't clear automatically on each render cycle. unfortunately, [gemframebuffer] seems to do exactly that (while in openFrameworks you always have to clear it manually). I think this is why Cyrille mentioned framebuffer ping ponging also in this context (outside shaders) because you can also use it to simulate an accumulating framebuffer.

> Gesendet: Sonntag, 09. April 2017 um 09:23 Uhr
> Von: "Roman Haefeli" <reduzent at gmail.com>
> An: pd-list at lists.iem.at
> Betreff: Re: [PD] [Gem] Modifying single pixel of pix image
>
> Thank you, Christof and Cyrille, for your insights. I think I
> understood the concept. But do I need even framebuffer ping-ponging
> when I only _add_ to the framebuffer? Let's say I add more and more
> pixel-sized white squares to the buffer, I can use this as my mask, no?
> 
> Roman
> 
> On Sam, 2017-04-08 at 11:05 +0200, cyrille henry wrote:
> > hello,
> > I use ping "pong buffer" frequentlly : using 2 framebuffer is a good
> > way to go.
> > 
> > There is an exemple in 10.glsl/07.framebuffer_and_shader : I use a
> > "ping pong" to create the wave physical model.
> > 
> > For your application, you don't even need a shader to alter the image
> > : you can draw the image, then draw a pixel size square where you
> > want to modify it.
> > 
> > c
> > 
> > 
> > Le 08/04/2017 à 10:51, Christof Ressi a écrit :
> > > 
> > > You could also experiment with fragment shader + "ping pong"
> > > framebuffers:
> > > 
> > > shaders usually don't have 'memory' of the last frame(s), so the
> > > idea is that you have two framebuffers and *alternately* take one's
> > > texture as input and draw to the other framebuffer. this way you
> > > can work on the previous frame and manipulate the alpha channel,
> > > e.g. subtract values from your alpha pixels based on some random
> > > function etc. You can define some uniforms to control the
> > > parameters of your decay formula from outside.
> > > 
> > > Framebuffer ping ponging is easy in openFrameworks, but I have
> > > never done it in GEM (honestly I haven't used GEM for a long time
> > > now). I guess you can use two [gemframebuffer] objects and switch
> > > your connections every other frame...
> > > 
> > > 
> > > > 
> > > > Gesendet: Samstag, 08. April 2017 um 10:32 Uhr
> > > > Von: "Christof Ressi" <christof.ressi at gmx.at>
> > > > An: "Roman Haefeli" <reduzent at gmail.com>
> > > > Cc: pd-list <pd-list at iem.at>
> > > > Betreff: Re: [PD] [Gem] Modifying single pixel of pix image
> > > > 
> > > > That's funny, I just did exactly this recently, but in
> > > > openFrameworks. If you want to do it entirely in GL (which will
> > > > be fastest), this is how I did it:
> > > > 
> > > > start with a white framebuffer and gradually draw black stuff in
> > > > there. Don't clear the framebuffer so it accumulates. You can
> > > > even draw with alpha blending to make the decomposition smooth.
> > > > Then simply use the texture of the framebuffer as the alpha mask
> > > > for your image texture.
> > > > 
> > > > I couldn't see how to do GL alpha masking in GEM but you can
> > > > easily write a little shader which takes the two textures as
> > > > uniforms, then you would just need to take one channel of the
> > > > mask texture and copy it to the alpha channel of your image
> > > > texture.
> > > > 
> > > > You can also try on the CPU level: create your mask in a table,
> > > > make it to a greyscale image and use pix_takealpha to copy your
> > > > alpha mask to your image pixels. Of course, this will be much
> > > > slower.
> > > > 
> > > > You can also mix the two approaches: create the mask on the CPU
> > > > and do actually masking in GL.
> > > > 
> > > > Hope that helps!
> > > > 
> > > > 
> > > > > 
> > > > > Gesendet: Samstag, 08. April 2017 um 10:02 Uhr
> > > > > Von: "Roman Haefeli" <reduzent at gmail.com>
> > > > > An: pd-list <pd-list at iem.at>
> > > > > Betreff: Re: [PD] [Gem] Modifying single pixel of pix image
> > > > > 
> > > > > On Sam, 2017-04-08 at 08:29 +0200, Christof Ressi wrote:
> > > > > > 
> > > > > > If it can be on the GPU, use a fragment shader! Do you work
> > > > > > with a
> > > > > > formula or do you set the alpha values by hand?
> > > > > By Hand (maybe later by a formula). Is it possible?
> > > > > 
> > > > > The idea is to have two overlaying images. The visible one
> > > > > slowly
> > > > > decomposes over time so that the image behind appears. I
> > > > > thought about
> > > > > setting alpha to for more and more pixels as a way to decompose
> > > > > the
> > > > > front image. Maybe there is another/better way?
> > > > > 
> > > > > Roman
> > > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > Gesendet: Freitag, 07. April 2017 um 23:39 Uhr
> > > > > > > Von: "Roman Haefeli" <reduzent at gmail.com>
> > > > > > > An: pd-list at lists.iem.at
> > > > > > > Betreff: [PD] [Gem] Modifying single pixel of pix image
> > > > > > > 
> > > > > > > Hi
> > > > > > > 
> > > > > > > Is it possible to manipulate a single pixel of a an image
> > > > > > > loaded by
> > > > > > > [pix_image]? Specifically, I'd like to change the alpha
> > > > > > > value of
> > > > > > > certain pixels. It doesn't matter to me whether the
> > > > > > > manipulation
> > > > > > > happens in the pix realm or the GL realm. Currently I can
> > > > > > > think
> > > > > > > only of
> > > > > > > cumbersome ways like using [pix_dump] -> [pix_set] and
> > > > > > > applying the
> > > > > > > manipulation to the largish list passed between them. Or by
> > > > > > > using
> > > > > > > [pix_pix2sig~] -> [pix_sig2pix~] which is basically the
> > > > > > > same, but
> > > > > > > would
> > > > > > > allow to do the manipulation on a table.
> > > > > > > 
> > > > > > > Roman
> > > > > > >  _______________________________________________
> > > > > > > Pd-list at lists.iem.at mailing list
> > > > > > > UNSUBSCRIBE and account-management -> https://lists.puredat
> > > > > > > a.info/l
> > > > > > > istinfo/pd-list
> > > > > > > _______________________________________________
> > > > > Pd-list at lists.iem.at mailing list
> > > > > UNSUBSCRIBE and account-management -> https://lists.puredata.in
> > > > > fo/listinfo/pd-list
> > > > > 
> > > > _______________________________________________
> > > > Pd-list at lists.iem.at mailing list
> > > > UNSUBSCRIBE and account-management -> https://lists.puredata.info
> > > > /listinfo/pd-list
> > > > 
> > > _______________________________________________
> > > Pd-list at lists.iem.at mailing list
> > > UNSUBSCRIBE and account-management -> https://lists.puredata.info/l
> > > istinfo/pd-list
> > > 
> > _______________________________________________
> > Pd-list at lists.iem.at mailing list
> > UNSUBSCRIBE and account-management -> https://lists.puredata.info/lis
> > tinfo/pd-list_______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list