alpha blending in overlapping semi-transparent lines

Recommended Posts

I'm using the Line class of Managed DirectX 1.1. I'd like to draw semi-transparent purple lines of width about 5. I'm drawing lines from a large data set and most of the place this works just great but sometimes the data causes lines to overlap. Where the lines overlap it effectively looks like the alpha channel for those "overlapped pixels" is 2X (or nX if there are 'n' overlapping lines). How can I keep it so that even where lines overlap the resultant transparency level remains constant?
I have the following RenderStates set:
Device.SetRenderState(RenderStates.SourceBlend, (int)Blend.SourceAlpha);
Device.SetRenderState(RenderStates.DestinationBlend, (int)Blend.InvSourceAlpha);
Device.SetRenderState(RenderStates.AlphaBlendEnable, true);
Device.SetRenderState(RenderStates.ZEnable, false);
Device.SetRenderState(RenderStates.ZBufferWriteEnable, true);
In the screenshot below, to the right (labeled "good") is a single line appearing as i want all the purple lines to appear. The label "bad" is pointing to what appears to be two lines but is actually 3, two of which are perfectly overlapping. Here is a case where i would not want the overlap to appear as dark as it does but instead want for it to appear as in the label "good".