I am trying to make certain sprites blend additively by using Bevy's sprite pipeline copied to my own app and adding a BlendState.
The BlendState is as follows:
BlendState {
color: BlendComponent {
src_factor: BlendFactor::SrcAlpha,
dst_factor: BlendFactor::One,
operation: BlendOperation::Add,
},
alpha: BlendComponent {
src_factor: BlendFactor::SrcAlpha,
dst_factor: BlendFactor::One,
operation: BlendOperation::Add,
},
}
With this, I assume that the alpha is squared as the src_factor of the alpha is itself.
So for example: if the alpha is 0.5, it will become 0.25.
And the color will be multiplied by this alpha since the src_factor is alpha.
So color of rgb(255, 0, 0) should become rgb(64, 0, 0).
However, by using a color picker on the resulting color with the background as black, the resulting color is rgb(187, 0, 0).
Also by using it on a back ground of rgb(28, 115, 112), the result becomes rgb(189, 115, 112). And 28 + 187 definitely isn't 189.
So it's not adding them.
Since I am new to graphics programming, I might have misunderstood how the blending function works.
Is additive blending possible?