Artifacts when using SamplerState.LinearClamp in SpriteBatch
- by Raymond Holmboe
I'm using XNA 4.0 and VS2010 Express for Windows Phone and Windows Phone SDK 7.1.
This is a platform game and I have a map made up of 16x16 textures that is drawn dynamically, tile by tile.
When using SpriteBatch to draw my map with LinearClamp, I get artifacts that looks like blurry thin lines.
They become visible when the camera moves from one pixel to another and when the camera is still, the artifacts disappear.
Here's a small sample of what I mean:
Here's how I draw with the spritebatch:
SBWorld.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, camera.View);
When using SamplerState.PointClamp the game just plays horribly (IMHO), so I cannot use that.
Why do these lines appear and how do I get rid of those?