Ah I run into this every time I take long breaks between making a project haha. What’s your SpriteBatch.Begin call look like? Are you using BlendState.NonPremultiplied? That’s usually the culprit.
Oh, great minds think alike! That’s exactly what I figured out, and came to post and you had come to the same conclusion! I am drawing paths, the circle is being drawn ever pixel and the opacity is ‘building up’ along the path. I reduced opacity to 0.2f and look:
You can see when the same path is ‘run twice’ the line is darker. I’m not sure what the solution to this is… hmmm.
Ended up by reducing the diameter of the circle, not caring about opacity and going with this:
I think this shows that ‘General Sumner’ controls these units. Not exactly the effect I wanted, but it will work. The only other way, that I can think of, is to plot all these paths in memory, copy memory to a PNG and then draw that. More work than I want for an effect, so I’m going with this.
Thanks for all the help! It got me thinking in the right direction!
Oh, I didn’t notice from your code above that you were drawing a circle over and over again to fill out a line. Good spot, @jonathanmcc!
@Ezra_Sidran, I’m glad you found something you like! That said, if you wanted to achieve the semi-opaque lines you originally wanted, I think you might need to change things up a bit.
You can draw lines with a SpriteBatch by stretching/rotating a pixel into a line. That would significantly cut down on your overlap (and draws!) but you would still get it on the edges where the line segments met. I think this might not look so great.
I’m not sure how well it would integrate with the SpriteBatch drawing, but alternatively you could draw the lines as geometry, calculating their bounds and rendering them as polygons. I did some work with this years ago and it’s relatively straight-forward, even to cleanly join two thick line segments, but you need to render it with GraphicsDevice.DrawUserIndexedPrimitives and so layering with your SpriteBatch might be more of a challenge. I think there are also libraries that will handle the geometry generation for you, and even add nice rounded end-caps to your lines.
If you’re happy with what you have and your performance is good, I wouldn’t change it, but if you do run into any performance issues than you might want to look at this. Drawing several hundred circles sprites per line might add up. I’m a big believer in optimize when you need to though. Just something to keep in mind.