I'm working on a project in XNA, and I'm using some rather large textures, which I'm loading into the game as Texture2D objects, and drawing on the screen much smaller than they are loaded in. The reason for this is that I need to draw them at various different sizes in different places, and, while I could do this with multiple textures, it is impractical to do so.
My problem is that XNA does not seem to antialias these Texture2D objects upon scaling them down. I have set:
graphics.PreferMultiSampling = true;
and also
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
But to no avail. I have also tried various things involving the filters in the GraphicsDevice but, to be honest, without really knowing what I was doing.
Obviously, I'm drawing this using a spriteBatch, but aside from that, nothing particularly interesting in the way I'm drawing it.
Here is an (enlarged) example of what's happening, and what I'm trying to make happen:
As you can see, XNA is not providing any anti-aliasing when rescaling the image. Is there a way I could force it to do so, in an effort to make the edges look cleaner?
Are you calling graphics.PreferMultiSampling = true;
before GraphicsDevice
is created? You must turn it on before it is created, either in the Game
constructor or Initialize()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With