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;
BlendOperation = BlendOperation.Add;
SourceAlphaBlend = BlendOption.One;
DestinationAlphaBlend = BlendOption.One;
AlphaBlendOperation = BlendOperation.Add;
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).