I am in the process of porting a game from Love2D over to Monogame and I am trying to recreate the same pixelated effect that was achieved using Love2D’s nearest filtering mode. I am currently upscaling using a Transform Matrix and using the PointClamp Sampler State. If you look at the guns in the attached image, you can see the Love2D version has the jagged look I am trying to achieve, while Monogame is smooth.
Just in case, I have also attached some code below so you can get an idea of what I am doing.
public void SetScreenResolution()
{
float tempXScale = (screenResolutionX / baseResolutionX);
float tempYScale = (screenResolutionY / baseResolutionY);
matrix = Matrix.CreateScale(tempXScale, tempYScale, 1);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.White);
// Draw background
_spriteBatch.Begin(blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.FrontToBack, samplerState: SamplerState.PointClamp, transformMatrix: matrix);
gameManager.DrawBackground(_spriteBatch);
_spriteBatch.End();
// Splatter
_spriteBatch.Begin(blendState: multiplyBlendState, sortMode: SpriteSortMode.FrontToBack, samplerState: SamplerState.PointClamp, transformMatrix: matrix);
gameManager.DrawSplatter(_spriteBatch);
_spriteBatch.End();
// Main Draw Loop
_spriteBatch.Begin(blendState: BlendState.AlphaBlend , sortMode: SpriteSortMode.FrontToBack, samplerState: SamplerState.PointClamp, transformMatrix: matrix);
gameManager.Draw(_spriteBatch);
_spriteBatch.End();
base.Draw(gameTime);
}