Preventing accidental sprite tiling without changing Wrap Mode to Clamp

One of my sprites appears to be tiling incorrectly. See below:

2915896--215120--Ib6dE6e.png

The problem is the horizontal blue line at the top of the effect. It goes away when I change the sprite’s import settings to Clamp rather than Repeat, but the shader uses a UV panner to loop the effect horizontally (in a wave-like pattern), so I can’t use the Clamp setting.

What causes this sort of tiling problem? The sprite is sized to exactly one unit, and the pixels per unit are set appropriately. I haven’t seen this with other tiles of the same size, so I suspect this has something to do with the shader, but I’m not sure where to start.

Add some padding to the texture and it should go away. The problem is most likely due to mip maps… you need to either pad the uvs, the texture or just not use mip maps… probably some other tricks to be had too.

1 Like

Thanks! I got it working now, but I have a couple of follow-up questions for future reference.

  • By padding the textures, do you mean adding a transparent 1px border around the source image? I tried that but I don’t think it made a difference.
  • How do you pad the UVs?

Turning off mip maps and pixel snap caused the line to disappear while the camera was static, but it still flickered back on when the camera was moving. Eventually I fixed the problem by switching the sprite’s filter mode from Bilinear to Point. I guess the pixel-perfect filter mode stopped the bottom of the sprite from bleeding over into the top, or something like that?

Glad you fixed it. By padding UVs I mean there’s a fudge made to the uv coords or shader, but it seems like it’s not needed now and you solved it.