Patakk
March 31, 2022, 3:12pm
#1
Hello!
I’m drawing a bunch of particles that have a fragment shader defined like this:
outputColor.rgb = someColor.rgb;
outputColor.a = 1. - smoothstep(0.25, 0.45, distFromCenter);
and blending set up like this
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
and I almost get what I expected, circles with smooth, but dark edges. As if the blending with the background somehow darkens the color.
Any tips on how to approach this?
Thanks
How should it look like? I mean what is that you are looking for?
Patakk
April 1, 2022, 12:41am
#3
Let me show you how the above image looks if I set the alpha to 100% (in this case it won’t be a circle, but a completely opaque square).
The edges between the shapes blend perfectly (I mean, there is no blending, because alpha for each shape is 100%).
But if start fading the edges (with alpha), it all falls apart, look:
How are you drawing each circle? and how is the blend happening?
can you try calling
ofEnableBlendMode(OF_BLENDMODE_ALPHA);
instead of the GL call you are using?
if it does not work try the other blend modes
///
/// OF_BLENDMODE_DISABLED
/// OF_BLENDMODE_ALPHA
/// OF_BLENDMODE_ADD
/// OF_BLENDMODE_SUBTRACT
/// OF_BLENDMODE_MULTIPLY
/// OF_BLENDMODE_SCREEN
///
I recall seeing something similar in the forum. try searching for issues with blending and alpha.