2
votes

In XNA, I am rendering textures using the PointClamp sampler state, and I have a tilemap using a horizontally aligned spritesheet of various 8 x 8 tile images to render each tile. I am also using a transformation matrix to scale and move the camera. My problem is that at a scale of 1, my tilemap sprites draw correctly, but at a higher scale (2, 3, etc.), the tile images offset by one pixel every so often as I move the camera around. You can see the problem I am having in this screenshot:

enter image description here

Also, the small white lines that appear are not supposed to be there, and only show up when the images are drawing offset like this. Does anyone know how I can avoid the tiles being drawn like this?

I have a feeling that the white "dots" are from neighboring tile in the spritesheet. I could add a 1 pixel buffer between the tile images on the spritesheet, but I'm afraid that just may cause transparent lines to appear between tiles when this problem occurs.

Hm... assuming your scaling is correct, perhaps a value is being rounded improperly at some point, such that it rounds up by a pixel and out of the proper bounds. But, without posting any code it is hard to help much more.Colton