Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Why are pixels "leaking" from behind my texture?

Discussion in '2D Experimental Preview' started by Xelnath, Jun 26, 2016.

  1. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    See image:

    Screen Shot 2016-06-26 at 4.39.40 PM.png

    I created a solid red "collider" image, then painted tiles over it. I confirmed the pixel -> 1.0 ratio is exactly 32 pixels (the width of the test texture).
     
  2. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    I was able to "fake" it by reducing the pixels -> 1.0 unit scale to 31... but this causes other issues, such as the tiles being slightly the wrong size.

    Screen Shot 2016-06-26 at 4.54.49 PM.png
     
  3. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    I'm having the same issue, also when using 32x32 tiles.
     
  4. Johaness_Reuben

    Johaness_Reuben

    Joined:
    Jan 27, 2016
    Posts:
    253
    Try setting the Sprites filter mode to Point.
    Also, try setting format to True Color instead of compressed.
    Compression/Filtering can lead to pixel bleeding.
     
  5. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Thanks for your reply, Johaness. I have my sprite sheet set up just as you said and I'm still having the issue.

    Perhaps it has something to do with the multiple sprite slicing? I used automatic grid based slicing...32x32 with no padding as that's how the sprite sheet is set up.

    I think it's also worth pointing out that it seems to be somewhat random. I can use the same tiles in different places and sometimes there will be a line of background pixels bleeding through, and sometimes there won't. I've had this problem with past versions of Unity as well unfortunately.
     
  6. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    When I set the sprite mode to "point" it was greatly improved.

    I could not find the Format option though.
     
  7. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    230
    upload_2016-7-3_12-42-11.gif
     

    Attached Files:

  8. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    That entire section is disabled for me. ^^
     
  9. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    230
    :confused: Could you post an screenshot?
    Seems strange to me, never happened before to me :)
     
  10. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
  11. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    230
    Yes, what i was expecting, easy fix :p check override for standalone hahaha
    You can also click default and change it there
     
  12. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    So i have to select "default" in the header? ok.
     
  13. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    Pack your sprites into an atlas to fix bleeding. You just need to enter something into the packing field tag to put them in an atlas.
     
  14. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    They are already in an Atlas, I think? Do you mean I need unity to repack them?
     
  15. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    If you have the atlas tag filled in and you have sprite packer always enabled then they will be in an atlas, which would mean that's not the problem. The sprite packer setting is in Edit -> Project Settings -> Editor.

    Edit: Also, make sure you are using the DefaultPackerPolicy. I get bleeding when I use the other ones. The setting for that is in the sprite packer window.
     
    Lapuss likes this.
  16. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    Alright, I tried this out and it seemed to work!
     
    Jay-Pavlina likes this.
  17. EmoryM

    EmoryM

    Joined:
    Feb 7, 2015
    Posts:
    3
    I ran into a similar problem, the solution was to disable anti-aliasing in Project Settings->Quality Settings under Rendering.
     
    ferenczp2005 and Ymrasu like this.
  18. nathan_epc

    nathan_epc

    Joined:
    Oct 8, 2015
    Posts:
    22
    This seems like a poor workflow for something most 2D games will want, will there be some work done to make this seamless?

    Or should we write our own, maybe read the asset name and if we match "*tilemap*" we set the correct import settings?
     
  19. ColossalPaul

    ColossalPaul

    Unity Technologies

    Joined:
    May 1, 2013
    Posts:
    174
    the problem is due to how we sample the pixels and if you don't leave any transparent borders, there are steps to take the change how the pixels are sampled.

    What you are alluding to is probably what we call the "one click solution to get pixel perfect mode"... we are still thinking how this could be done... not sure yet. Do share if you have some ideas.
     
    Lapuss and jc-drile77 like this.
  20. TGrimace

    TGrimace

    Joined:
    Dec 30, 2013
    Posts:
    3
    I found that if I up the "Max Size", it helps significantly. It usually solves the problem for me.