Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a tile based game. Each tile texture is loaded and then I draw each one next to the other, forming a continuous background. I actually followed this tutorial for the xml files.

The sources of the textures are 50x50.

However, it works only it the scale is 1 (or lower), if the scale is greater

The results:

Larger size (Zoomed or 100 pixel in xml file) enter image description here

We can see there are lines between the tiles, which are not in the texture. It's actually not so bad here, but in my game tileset, that's what it does:

enter image description here

The same effect is present whether I increase the tile size in the xml file, change the scale when drawing or use my camera to zoom.

//zoom code
public Matrix GetTransformation()
       Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
       Matrix.CreateRotationZ(Rotation) *
       Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
       Matrix.CreateTranslation(new Vector3(_device.Viewport.Width * 0.5f, _device.Viewport.Height * 0.5f, 0));

  BlendState.AlphaBlend, null, null, null, null,

//for each tile
theSpriteBatch.Draw(mSpriteTexture, Position, Source, 
  Color.Lerp(Color.White, Color.Transparent, mAlphaValue),
  mRotation, new Vector2(mSource.Width / 2, mSource.Height / 2),
  Scale, SpriteEffects.None, mDepth);

Is there a reason for this? A way to fix it to have a continuous texture when zoomed?

share|improve this question
How are you calculating the Position for each tile? I just gave it a try and it worked fine even when zooming... – David Gouveia May 13 '12 at 10:53

1 Answer 1

up vote 3 down vote accepted

Use SamplerState.PointClamp to avoid the GPU interpolating texture coordinates with the nearest points.

share|improve this answer
That worked ^^ Sorry for the double question (in stack overflow too) – Amaranth May 13 '12 at 15:21

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.