Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Tilemap sprite slicing artifacts

Discussion in '2D' started by Good_Punk, Nov 17, 2021.

  1. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Hi,

    I get flickering artifacts between my tiles very randomly while walking over the tilemap. It seems the artifacts is related to the Sprite slicing, as the artifact is a 1px line from a neighboring tile. (see screenshot) And probably the camera angle, as the artifacts only appear in horizontal lines. The artifacts don't appear regularly, they appear and disappear while walking creating a flickering effect.

    I've set the png to Point Filtering and no compression and pixel-perfectly sliced the image in 32x32px squares. Also tried to turn of anti-aliasing but the artifacts remain.

    I've found threads with similiar issues but none seemed to be exactly this or there was no answer given.
     

    Attached Files:

  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    Increase padding between sprites in the spritesheet.
     
  3. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    While this is true, you don't have to do it manually.
    Create a Sprite Atlas and add your spritesheet. There's an option in the Atlas that automatically adds the padding. But be warned that the Scene view might still look like this. Ingame it should fix the problem.
     
  4. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    246
    Yes, exactly like what Lo-renzo and Zephus mentioned. It's an oversampling issue.

    Here's a short and concise YouTube tutorial on how to create a Sprite Atlas with your Spritesheets to remove those line artefacts. Sprite atlasing helps to add some padding to the tiles thus removing those border lines you see during runtime.

    Moreover, other than the visual fix, Sprite atlasing also comes with other advantages too. One would be a smaller performance overhead as Unity can call this single Texture to issue a single draw call instead of multiple draw calls. Here's a more detailed documentation on Spirte Atlasing. :)
     
  5. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Worked like a charm. Thanks very much! :)