# How to setup a particular blend state where the alpha channel is additive?

I would like to set a blend state to be "additive" and do the following:

Result.R = Source.R + Destination.R;
Result.G = Source.G + Destination.G;
Result.B = Source.B + Destination.B;
Result.A = Source.A + Destination.A;


So I've tried setting a blend state to:

IsBlendEnabled = 1;
SourceBlend = BlendOption.One;
DestinationBlend = BlendOption.One;
SourceAlphaBlend = BlendOption.One;
DestinationAlphaBlend = BlendOption.One;


I was thinking it would do:

Result = Source*BlendOption.One + Destination*BlendOption.One;


But I doesn't work (I've tried so other combinations as well). The color (RGB) channels are adding up correctly but the alpha channel is not (it's not affected by the blend finally, but still not adding up). I'm drawing three overlapping quads with different colors (red, green, blue) and alpha of 0.1. But result alpha is not 0.0-0.3 (0.0 = no overlap, 0.1 = one quad, 0.2 = two quads overlap, 0.3 = three quads overlap) as I would expect.

Is it even possible to setup blend state to accumulate alpha on render target?

Note: I would like to have a color map (RGB) being mixed and alpha channel indicating how many quads are overlapping (0-3 quads => 0.0-0.3 alpha value).

• I even replaced RGB with 0.1 and it adds up nicely in a result. Creating overlap. All three RGB channels except alpha. It's somehow still 1 everywhere. Why it doesn't work for it as well? – SmartK8 Oct 18 '14 at 11:21
• Have you tried setting the BlendState in your spritebatch initialization? BlendState.Additive? – jgallant Oct 18 '14 at 18:23
• Hi, I'm drawing a triangle list directly via a DrawIndexed. I've tried a BlendStates.Additive, it works for the colors, but it messes up the alpha channel as well. It was not working that lead me to create my own blend state in the first place. I've tried all the preprepared ones (Default doesn't erase alpha, but it doesn't blend at all so I've excluded it immediately). – SmartK8 Oct 18 '14 at 18:27
• Ok, you may have to set the Pre-multiply Alpha attribute of your texture, to false. I've had issues in the past when trying to do additive blending. Take a look here for more details: blogs.msdn.com/b/shawnhar/archive/2010/04/08/… – jgallant Oct 18 '14 at 18:35
• Isn't this like for already made textures? My texture (render target) starts as black (I'm even calling explicitly Clear). 1) I clear the render target, 2) I draw first quad (red), 3) than the other two, 3) I check the resulting texture if it contains summed alpha channel, 4) I'm disappointed because it doesn't. – SmartK8 Oct 18 '14 at 18:41