[PD] GEM: writing an arbitrary blend function (glsl)?
doktorp at mac.com
Sat Dec 26 19:39:58 CET 2009
Ah, sorry, I had missed that you wanted to use fixed function and not
require more than one texture. I can tell you that you cannot get all
of the arbitrary blend modes using just glBlendFunc and
glBlendEquation. GLSL is infinitely more flexible.
I would highly suggest doing a render to texture so you can post
process your scene or mix with multi-textures. You can also do fun
things like full scene blur, etc. Its how almost all modern games and
graphics systems work these days, using render to texture and post
processing pipelines and lets you do lots of things 'on top' of your
fixed function rendering if you decide you want to add something else
to your scene.
As for difference, Im pretty sure you *can* do that blend mode, but I
have not done it myself, sorry I cant be more helpful.
On Dec 26, 2009, at 5:18 AM, Matteo Sisti Sette wrote:
> 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.
> 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
> 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
> 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
> 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
> Matteo Sisti Sette
> matteosistisette at gmail.com
More information about the Pd-list