Seams in 2D Pixel Art

Disclaimer: Sorry for the length of this question, but I wanted to be as complete as possible. I’ve been smashing my face against this problem on and off for a few weeks and I can’t get to the bottom of it. I’ve read every posting in the forums and Answers that seemed remotely relevant and loads of 3rd party blogs and Youtube tutorials, but I can’t find a solution to the problem.

I’m attempting to recreate parts of Link to the Past to learn the new Unity 2D feature set. Everything is going well except when it comes to rendering from a texture atlas =) I’m getting vertical and horizontal seams with all of my sprites. The problem is most readily seen on the background map, but it happens with the player, bombs and other entities sometimes.

Here’s a screenshot of the problem: Imgur: The magic of the Internet I’m trying to remove the seams between the background tiles.

All of my images are imported as Advanced textures, with Mip Maps disabled, Point for the Filter Mode, and they’re all powers of 2. The Max Size of all textures is set to the actual image dimension. All Sprite Sheets have a Pixels To Units value of 16. A tile on the map has a height and width of 1 unit. All background tiles are contained in a single mesh built at runtime; each tile has its own vertices and UV coordinates.

My tiles are 16x16 pixels (1x1 units), the texture atlas for the background is 1024x1024. The game window is using a fixed size of 512x448, which is double the size of the SNES resolution. So, the main camera uses orthographic size of 7 (screenHeight / pixelToUnitRatio / Zoom / 2; 448 / 16 / 2 / 2 = 7)

When the camera moves, the horizontal seams in my screenshot flicker. If the player moves horizontally, then vertical seams will appear too. Sometimes you can stand just right and the seams go away, but I haven’t found that this occurs with any predictability. The camera uses a basic follow-target script. Disabling this script and moving the camera manually also causes the problem. Moving the camera to integer coordinates (such as 10, 10 - which would be squared up with the map) causes the lines to show in both directions.

Failed attempts to remove the seams:

  1. I tried clamping the camera’s position to a “pixel-value”; to multiples of 1/16 (0.0625F). This removed the vertical seams (which flicker when moving left and right), but I couldn’t figure out the period of “okay values” for the vertical.

  2. I tried up-scaling everything so that 1 unit = 1 pixel (as most tutorials seem to use), but this had no effect on the problem.

  3. I tried reducing the texture atlas to a 32x32 image (2x2 tiles), with the hope of a floating point problem introducing errors in the calculated UV coords, but using hardcoded values of 0.0F, 0.5F and 1.0F with this smaller image also shows the same problem.

  4. I tried adding a border to all tiles in the texture atlas by duplicating the outside-edges of each tile, but this caused the pixel art to “wave” as the camera moved.

  5. I also tried shifting the UV coordinates by 0.001F (and similarly small values) to squeeze them away from the tile edges; this also caused a “wave” in the pixel art.

  6. I tried creating separate, discrete gameobjects using 1x1 planes (which is obviously riddled with performance issues), but I successfully reproduced the problem with this design as well.

  7. Changing the camera’s orthographic size also causes the lines to flicker, but there isn’t a “sweet spot” that makes them go away (that I’ve found).

I’ve confirmed that the geometry is whole and complete – the seams are not gaps in geometry.

My gut says that it’s a problem with UVs (or some related setting that I haven’t heard of yet) or a problem with the camera configuration.

I don’t want to just paste my code and say “debug please”, and I’m hesitant to ask the question because there are SO MANY articles related to this already, but I’m scraping bottom and just spinning my wheels now.

Any advice?

I just found the answer! Edit → Project Settings → QualitySettings and Disable “Anti Aliasing”

I used to get around my problem by snapping my camera to my pixel grid, but that lead to weird visual disturbances when I started dithering some textures.