yes, that's a nice patch. i am still wondering though why it doesn't look the same (sharp) when done without glsl. i remember someone said that he was working on making glsl abstractions to replace some of the pix_ es m.
(posting back to pd-list, hope that's okay for you)
Am 09.11.2011 um 16:23 schrieb Guido Tamino:
Hello,
I've put together this quick and dirty glsl patch for alpha masking. http://www.mediafire.com/file/c5cey458piu1d47/glslMask.zip
Hope it helps.
Best, Guido
Il giorno 09/nov/11, alle ore 15:01, Max ha scritto:
<masking4.pd>
Am 09.11.2011 um 14:41 schrieb cyrille henry:
Le 09/11/2011 12:23, Max a écrit :
thanks cyrille, am i getting closer?
yes, a bit. except that :
- gemframbuffer does not have the same camera position than gemhead.
you need to add translateXYZ 0 0 -4
ah, right. works! but looks terrible. i am wondering why the resolution and edge looks so bad.
- pix_snap snap the curent frambuffer, you don't need to pass the framebuffer texture.
see attachment.
it's ok if it is slow, but i want to use gem objects to make a mask i can animate in gem, so there is now way around the snapping if i understand that correctly.
it's possible with shader : render 1st scene in a frambuffer other scene in a 2nd frambuffer. set it to use texunit 1 then, use something like the example : 10.glsl/5.multitexture, and change a bit the mixing equation.
ok, seems that the answer on anything gem related i try lately is glsl. max
cyrille
max
Am 09.11.2011 um 14:07 schrieb cyrille henry:
hello, pix_masque need a pix, not a texture. (one is in the CPU, the other in the GPU). you need a pix_snap to pass the texture to a pix object. beware, this is slow. i recommend using a shader to emulate pix_masque, but using 2 texture and not 2 pix. it will be hundred time faster.
Cyrille
Le 09/11/2011 11:52, Max a écrit :
dear list,
i'm trying to generate a b/w mask in gemframebuffer for a pix_mask pix_mask seems to ignore the texture from gemframbuffer. hints appreciated. m.
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
<masking3.pd>
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hey there,
On 09.11.2011 15:53, Max wrote:
i remember someone said that he was working on making glsl abstractions to replace some of the pix_ es
some time ago, i have made a video-mixer to replace the example in 04.pix/12.blending.pd, that routes the signal into each appropriate pix, with one shader program, initially because i wanted to have hard-light blending and writing a shader seemed easier than adding a pix_ object. i then added some effects to it, so i kind of have replaced some pixes with shaders, but in one rather large fragment shader program, rather than single abstractions.
following your suggestion, i moved some code into individual abstractions and it basically works to prove the concept, but there's some limitations. every abstraction needs to render its output into a frambuffer with a texunit assgined to it as input for the fragment program, but afaik the number of texunits is limited[1] and you need to track their index globally. some pix operation will need more than one texunit and the number or the overall memory of framebuffers might as well be limited.
anyway i will continue to experiment on that, but if something in the direction of pix replacement (or frei0r replacement for that matter) has already been done, i'd be curious to see it. :)
ciao, ub
[1] http://www.opengl.org/wiki/GLSL_Sampler#Binding_textures_to_samplers
Le 15/11/2011 18:05, ub@xdv.org a écrit :
hey there,
On 09.11.2011 15:53, Max wrote:
i remember someone said that he was working on making glsl abstractions to replace some of the pix_ es
some time ago, i have made a video-mixer to replace the example in 04.pix/12.blending.pd, that routes the signal into each appropriate pix, with one shader program, initially because i wanted to have hard-light blending and writing a shader seemed easier than adding a pix_ object. i then added some effects to it, so i kind of have replaced some pixes with shaders, but in one rather large fragment shader program, rather than single abstractions.
following your suggestion, i moved some code into individual abstractions and it basically works to prove the concept, but there's some limitations. every abstraction needs to render its output into a frambuffer with a texunit assgined to it as input for the fragment program, but afaik the number of texunits is limited[1] and you need to track their index globally. some pix operation will need more than one texunit and the number or the overall memory of framebuffers might as well be limited.
anyway i will continue to experiment on that, but if something in the direction of pix replacement (or frei0r replacement for that matter) has already been done, i'd be curious to see it. :)
ciao, ub
[1] http://www.opengl.org/wiki/GLSL_Sampler#Binding_textures_to_samplers
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
It is possible to use /Gem/examples/10.glsl/06.rectangle_multitexture.pd to simulate [pix_mask] with shaders. Load your mask and your picture with the two yellow bang and click on the message 'multiply'. This patch works with graphic cards compatible with shader 4.
If your graphic card is compatible with shader <= 3, then use /Gem/examples/10.glsl/05.multitexture.pd and modify a little bit the fragment shader.
I have done this small patch (ttached and compatible GPU shader 4) for people who want a small patch example. Hope it can be useful. ++
Jack