XNA: Applying SpriteBatch.Draw color (...) to opaque pixels only
I have a sprite loaded from a PNG that has an alpha channel. The image contains an opaque disc and the rest is transparent.
I want to use an argument color
SpriteBatch.Draw(...)
to change the hue of the disc. However, the default blending behavior applies color to the entire sprite, so I end up with an opaque square outline around the shaded disk.
Is there a way to change the blend mode so that transparent pixels don't affect the argument color
?
a source to share
I've never seen this happen and I've worked with transparent PNGs like this since XNA. Do you mix 2D and 3D? If so, setting up 3D rendering might confuse SpriteBatch, but I thought SpriteBatch should have set them correctly for you. Maybe there is something wrong with the PNG image you are using?
a source to share