Lines in Tilemap

Hello,

I know this is a common problem, but i need help…

I draw my Tilemap on to two Rendertargets.

There lines they are some kind of transparent.

I put 16 pixel transparent space between each tile…(what a commen answer was) it doesnt helped me…

SamplerState.PointClamp removed somelines but not all, and is not good thing, because my camera interpolates and get blurry as it moves.

Here you can see a white line from the white rect wich is behind the tile
(This with PointClamp)

(This is with LinearClamp)

Any suggestions are welcome!

Are you using SpriteBatch? If not, what does your projection Matrix look like? There is a discrepancy between position of pixels and position of texels when sampling.

I am using SpriteBatch with this as last parameter:

ZoomVert = (DisplayHandling.TargetResolution.Y) / (DisplayHandling.BaseResolution.Y);
ZoomHori = (DisplayHandling.TargetResolution.X) / (DisplayHandling.BaseResolution.X);

public Matrix TransformMatrix
{
get
{
return
Matrix.CreateTranslation(new Vector3(-Location.X, -Location.Y, 0.0f)) *
Matrix.CreateRotationZ(Rotation) *
Matrix.CreateScale(ZoomHori2.0f, ZoomVert2.0f, 1.0f);
}
}

spriteBatch.Begin(SpriteSortMode.FrontToBack,null, SamplerState.LinearClamp, null, null, null, Utilities.Camera.Instance.TransformMatrix);
   
scene.Draw(spriteBatch); 
     
spriteBatch.End();

Clamp only affects how texels are retrieved at the edge of a texture (whether they clamp to the edge of the texture or wrap to other side), not the edge of a rectangle within a texture.

When you had the 16-pixel transparency (you don’t need that much as linear only goes for one or two pixels), what was the rectangle that you used for the tile? Did it include any of the bounding transparency? It should just include the tile itself and none of the bounding transparency.

Ideally, you wouldn’t have transparency in the immediate neighbouring texels, but copies of the texels from the other side of the tile. This means the linear filtering will filter with valid texel values rather than filtering transparency into your edges. The part you render is still the size of the tile, but it will have valid tile data to filter with just outside the render rect.

Okay, i am closer to the solution now!

I add SamplerState.PointClamp when draw to rendertarget…
All lines are gone,when i use PointClamp as i draw to screen as well!
With LinearClamp

The line apears where upperRenderTarget and lowerRenderTarget met each other…
With PointClamp

^this looks right to me

I am not totally sure, if the “blurryness” while moving comes from the framedrops i have(same problem as in the other thread in this forum) or not.
Fraps shows 59-61 fps switch it like crazy back and forth.( Is my second problem)