Artifacts when using SamplerState.LinearClamp in SpriteBatch

Posted by Raymond Holmboe on Game Development See other posts from Game Development or by Raymond Holmboe
Published on 2012-10-02T12:29:39Z Indexed on 2012/10/02 15:54 UTC
Read the original article Hit count: 364

Filed under:
|
|
|

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:

line artifacts

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?

© Game Development or respective owner

Related posts about XNA

Related posts about textures