Blend Mode Screen or Add without saturating the brightest color

Today I needed some way of use blending screen or add without burning and saturating the colors, to be able to make trails in images without alpha (cairo to opengl).
Using OF_BLENDMODE_SCREEN or OF_BLENDMODE_ADD saturate and change colors, so I had to find something similar to “screen” or “add” of *Abode bhotoshop-alike software.

Here is the solution to sum and keep the most bright color intact, in the case anybody else needs it.

            glEnable(GL_BLEND);
            glBlendEquation(GL_MAX);
            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
1 Like

this seems like an easy and useful addition to the core.
can you make a PR?

1 Like

Yes totally.
But I think there are decisions involved, likereplacing OF_BLENDMODE_SCREEN or inventing a new blend mode name.
I understand OFW project is conservative as trying not to change or replace functionalities.

No, I would say adding a new mode. Yes, replacing is not a good idea, but adding does not look harmful and it is just very few lines of code. You would need to add it to ofGLRenderer, ofGLProgrammableRenderer and ofCairoRenderer so it is consistent. Although I dont know how to implement it in cairo. You would need a new name for this blend mode. @arturo @zach @theo what do you think?