   2D in 3D Texture woe with C# (pictures! yay!)[Solved .. I think]
  I'm aware of the texel thing and the article over on MSDN but I still can't seem to get everything to go right. I'm hoping some one here will be able to put me out of my misery.I'm using quads as 2D tiles - I can plot them no problem but when I move around the textures get screwed up.Here's what it looks like at the start:This is my debug tile, all the sides are different colours and the middle has a nice gradient, everything is okay.Now I moved up or down and a bit annnnddd...The pink line comes from the space surrounding my texture in the main texture file. Why grahhhh?Here's the code: Problem.zip(Visual Studio 2005)It's very light - I've written it especially just to try and sort out this problem. I would love someone to be able to tell me what changes I would need to make. I'm not in love with the current aspect ratio I'm willing to change :DThe likely culpritsThe actually quad size which is currently like this:verts[TopRight].Position = new Vector3(0.25f - 0.003f, 0 - 0.003f, 1f);verts[BottomRight].Position = new Vector3(0.25f - 0.003f, -0.25f - 0.003f, 1f);verts[BottomLeft].Position = new Vector3(0 - 0.003f, -0.25f - 0.003f, 1f);verts[TopLeft].Position = new Vector3(0 -0.003f, 0-0.003f, 1f);   The 0.003f business is making my texels pixel specific or so I hope.The camera setupdevice.Transform.Projection = Matrix.OrthoLH(5.0f, 5.0f, 0, 1.0f);Or sometimes I have it like thisdevice.Transform.Projection = Matrix.OrthoLH(5f,3.75f, 0.0f, 1.0f);Making my tiles nice and not squashed - either way I'm stuck with the same problem.Please help me and my hair.[Edited by - Balaam on December 13, 2005 2:03:53 AM]
  With help I've managed to remove the pink lines by clamping the texture.I added this code on setting up the device.device.SamplerState[0].AddressU = TextureAddress.Clamp; device.SamplerState[0].AddressV = TextureAddress.Clamp; device.SamplerState[0].AddressW = TextureAddress.Clamp; But when moving the border lines of my tile still thicken to two pixels when they should be one and sometimes disappear entirely.There should be one pixel red line at the bottom of these tiles.   ;  If you are trying to use projection coords its possible to get this kind of artifacts. To avoid getting this use TransFormed lit vertices so you can use real screen coords.Luck!Guimo;  I'd really rather avoid that approach unless there's really no other option.In transformed coords all the vertices have screen locations - so as far as understand it I'd have to modify the vertices each frame to render the same tile at different places.   ;  Okay I think I've managed to fix this. So I'll write up what I did just in case anyone else finds themself in the same position.My quads where quite small like 0.5 and I was moving the camera over them by a very small increment. I'm guessing the problem was rounding error. So to solve this I increased the camera movement step, increased the quad size to a few points squared and pushed up the resolution. This seemed to make all the bad things go away :D   