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

I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of interpolation. How would I accomplish that?

share|improve this question
up vote 21 down vote accepted

You need to set the sampler state. The default for SpriteBatch is SamplerState.LinearClamp (ie: linear interpolation - the smooth/blurry one).

Choose one of the SpriteBatch.Begin calls that takes a SamplerState and pass in SamplerState.PointClamp (selects the pixel at that precice "point").

share|improve this answer
Thanks, that worked great. – Daniel T. Dec 26 '10 at 11:11

Just in case someone else is wondering how to do this outside of a sprite batch, you would do this just before rendering your primitives:

this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

This has to be done on every frame, if there are other items in your rendering pipeline that would change this value (like a SpriteBatch).

share|improve this answer
Yep! And just for the sake of completeness, there's also a SamplerState.PointWrap if you'd like texture wrapping to take place (while still disabling texture filtering). Or if you need your own custom behavior, you can create a new SamplerState object to fit any custom needs, and change the Filter property to TextureFilter.Point. – David Gouveia Jan 2 '12 at 1:49

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.