Sprite Scaling Problem

I’m trying to scale a sprite I’ve took from a sprite sheet as the original size of the sprite is tiny. I’ve noticed a problem though with this, that if I scale the sprite, it becomes quite blurry despite being pixelated which of course isn’t what I want so I was wondering if anyone knows of a better way of scaling my sprite that won’t cause the sprite to blur.

Thats always the case if you rescale an image, not a monogame thing.

You can recreate it from scratch with a higher resolution.

1 Like

In your SpriteBatch.Begin() call, pass in SamplerState.PointClamp (or PointWrap) to prevent blending.

2 Likes

Yes, if you use point sampling the upscaled image will stay pixelated. SpriteBatch.Begin takes a Sampler state as an argument though, not SpriteBatch.Draw.

1 Like

You are correct. I’ve edited.

You can turn off graphics.PreferMultiSampling = false; typically in initialize when after the graphics device is set up.

In addition to setting the SamplerState. you can create your own states then just pass them to the graphics device. This usefull especially if your drawing quads or primitives.
For instance you might toggle a bool when the s key is pressed such as showAnisotropicOrPoint.

        if( showAnisotropicClamp)
        {
            GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicClamp;
        }
        else
        {
            GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
        }

Anti alias only works on geometry, it does not matter in this case. This is about sampling. The geometry drawn by SpriteBatch are rectangles.