Search Unity

Tile Map Tearing Problems

Discussion in '2D' started by mactinite77, Jan 31, 2014.

  1. akshay2001

    akshay2001

    Joined:
    Dec 22, 2015
    Posts:
    9
    Thanks! This method really works You helped me from the trouble of redoing all my work.
     
  2. AShenawy

    AShenawy

    Joined:
    Apr 3, 2018
    Posts:
    4
    I guess it's been a while since any updates on this thread, but it does include multiple solutions so at least one is bound to work. I just had the same issue and what worked for me was disabling the AA in quality settings, like Fariel mentioned:
    To do this go to "Edit > Project Settings > Quality" and for every level of quality I disabled the Anti Aliasing. This fixed it instantly in the editor, didn't even have to build to double check.. but I did anyway :D

    Let me add that my issue was not gaps between tiles but rather streaks of solid lines that may or may not show at random.
     
  3. fatassmofu

    fatassmofu

    Joined:
    Aug 5, 2018
    Posts:
    1
    I have this problem for almost a week, already tried yours. It worked at first, but I forget to save the game, next time When I try to use this "New material" solution, it's just not working. Those lines don't pop up again but, more lines appear
    Do you know how to fix those? still trying other solutions.
     
  4. bodart_a

    bodart_a

    Joined:
    Oct 12, 2015
    Posts:
    3
    I think I just found a good solution for using dark textures reacting with lights !
    /!\ This solution is only for those who use the Tilemap Unity system.

    Just create a new material with the following shader : "Legacy Shader/Diffuse" (because the Sprites/Diffuse shader doesn't work).

    And apply this material to your tilemap into "Tilemap Renderer".

    This solution worked for me on my tilemaps. Fell free to ask me more precisions if you need it.
     
    Last edited: Aug 13, 2018
  5. aledbarreto

    aledbarreto

    Joined:
    Jan 28, 2019
    Posts:
    1
    Hello everybody!!

    Dealing with this problem I found out that the only definitive solution is putting a 2px padding in every tile. I tried everything and randomly happens in animations. It feels good to know that I wasn't the only one with this problem, I thought I was doing something really wrong
     
  6. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Last edited: Jun 11, 2019
  7. GalopeTeam

    GalopeTeam

    Joined:
    May 13, 2014
    Posts:
    8
    I found a solution using Unity's native tilemap.

    After losing all the weekend looking for that Pixel Bleeding issue I almost give up using Sprite Sheet, but then I could understand better the cause of this problem and found a rather simple solution. It won't use any plugin or special coding.

    In my case I'm using 16x16 block size and 1.1 camera size.
    • - No Pixel Snap Material
    • - No Manual sprite extrude and extrude edges 1 (sprite default)
    • - Mesh type Tight
    • - Sprite Atlas with Filter mode Point and Format RGBA 32

    All I had to do was resize the tile by removing -0.0001 pixels both in X and Y.



    This negative micro-pixel won't affect the visuals of any sprite and it will fix the pixel bleeding. I tested for an hour and the issue was gone.



    This is barely noticeable and appears only in the corners, I noticed because I was using a pink bg to make sure I could see the line. Using a black background solve this or another sprite below.
     
    Last edited: Jun 11, 2019
  8. Nope404

    Nope404

    Joined:
    Jun 3, 2016
    Posts:
    2
    Love your solution! Thank you
     
  9. Tammaire

    Tammaire

    Joined:
    Feb 21, 2019
    Posts:
    1
    Hello, guys, I'm continuing the glorious necroing to add a solution that worked for me <3

    Adding the spritesheet into an atlas seemed to have fixed the problem.
    I started with a solution using the sprite packer (over there : https://nielson.io/2015/10/fixing-gaps-between-sprites-better-2d-in-unity-part-2) but this tool being legacy, now, I tried to find the replacement and found a video explaining the sprite atlas (
    )

    The documentation is here : https://docs.unity3d.com/Manual/class-SpriteAtlas.html

    Note : I also used the pixel snap thingy (that's wasn't enough) and the automatic orthographic change wasn't fixing the tearing either for me (and I didn't want to use it anyway). Disabling all of these seems to be still working, leaving only the atlas.
     
  10. BKinAK

    BKinAK

    Joined:
    Mar 6, 2014
    Posts:
    2
    This fixed it for me too. Thank you!
     
  11. PerryProject

    PerryProject

    Joined:
    May 5, 2020
    Posts:
    1
    Great solution, this worked!
     
    GalopeTeam likes this.
  12. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    Honestly, just use a Sprite Atlas. It'll add padding that completely eliminates these issues without having to resort to such a hacky solution. In addition to that it also makes loading your assets much more efficient.
     
    MousePods likes this.
  13. GalopeTeam

    GalopeTeam

    Joined:
    May 13, 2014
    Posts:
    8
    Sprite Atlas didn't work for everyone unfortunately (myself included). Only this trick works for me in that time, but now with Unity official "Pixel Perfect Camera", maybe this problem is not a issue anymore.
     
  14. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    I thought you were using that already. Of course you need to use a pixel perfect camera, but in addition to that without padding you'll still get seems on some tiles.
     
  15. GalopeTeam

    GalopeTeam

    Joined:
    May 13, 2014
    Posts:
    8
    In my case, the pixel perfect camera fixed all issues related to bleeding, but in Unity 2018 I'm still getting incorrect align edges in timemap "Composite Collider 2D" (something similar to ghost edges), and once more, this trick was the only way I found to a cheap fix. Using the Unity 2019 LTS, all problems are fixed in my projects.
     
  16. TomNCatz

    TomNCatz

    Joined:
    Jan 6, 2015
    Posts:
    24
    More of a side note, instead of changing the sprites to have an overflow I changed the grid to have a tiny, tiny overlap. This was enough to fix my tearing issue at any resolution without needing to alter any sprites, imports, or workflow and did not have any constraints on resolution or camera.

    upload_2022-4-12_10-26-20.png

    While all solutions so far seem a little hacky(including this one) this seems to have the fewest drawbacks and least hassle.
     
    CarterG81 likes this.