Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the opacity or transparency for a texture or sprite?

share|improve this question
up vote 4 down vote accepted

Yes. You can make a semi-transparent version of any colour by multiplying it by a floating point number. For example:

Color halfOpacityWhite = Color.White * 0.5f;

spriteBatch.Draw(myTexture, Vector2.Zero, halfOpacityWhite);
share|improve this answer


You need to use this overload of the SpriteBatch (or another overload that has the blend state option) with the blend state set to the Alpha Blend blend state. Then in the SpriteBatch.Draw method use a white color with the alpha (transparency) value you would like to have. You can use the Color.FromARGB() method to construct a semi transparent white color.

share|improve this answer
It's worth pointing out that BlendState.AlphaBlend is the default, so you don't need to specify it. And that Color.FromARGB (as far as I can tell) doesn't exist. I think you might have meant FromNonPremultiplied (noting that the default AlphaBlend blend mode requires colours to be in premultiplied format). – Andrew Russell Aug 6 '12 at 12:56
Andrew is totally right, I've worked mostly with XNA 3 so I keep forgetting about premultiplied colours. – Roy T. Aug 6 '12 at 16:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.