[PD] GEM: writing an arbitrary blend function (glsl)?

Matteo Sisti Sette matteosistisette at gmail.com
Sat Dec 26 11:18:53 CET 2009


vade escribió:
> You can do arbitrary blend modes in PD with GLSL as you suspect. take a 
> look at http://001.vade.info/?page_id=20 which has shaders for video 
> mixers (a through a+b to  b blending, not just a+b)  with most photoshop 
> blend modes.

Hi,

I just had a very quick look, but it seems to me that your mixers use 2 
textures, very much like the "multi texture" example I mentioned.

To use them, you need two textures and you obtain the blended picture.

I was looking for a way to replace the blend function, the very same 
function whose parameters you can modify using glBlendFunc and 
glBlendEquation.

In order to use a two-texture mixer for my purpose (which is to change 
how the object blends with the background), I would need to repatch 
everything so that I snap the scene into a texture before blending. In 
my case it would be quite a radical repatching.

However, after a little bit of googling, it seems that what I would like 
to do is simply impossible, isn't it? If I understand correctly, with 
glsl one can "only" modify the vertex and fragment transformations, 
while the blending phase cannot be modified. Is it correct?

If so, is there a way I could do "difference" blending, that is the 
absolute value of the difference between source and destination colors? 
I have already done additive and multiplicative blending with 
glBlendFunc alone, and I should be able to do subtractive with 
glBlendEquation... can anybody suggest a way to get the absolute value?

Thanks
m.

-- 
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com




More information about the Pd-list mailing list