Search Unity

2D sprite renders a small part of another one with "Sprite Mode : Multiple"

Discussion in '2D' started by Razouille, Jun 2, 2016.

  1. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Hello,

    I'm stuck with a big issue in my game : bug1.png
    As you can see there is a small black line on the top of the sprite (one brown square represents a pixel in the game).

    Actually this black line is a part an other sprite sliced in the same spritesheet (on the top of it) : bug3.png

    I'm stuck because i'm already using the Filter Mode to Point : bug2.png

    My sprites are all stick together without any blank space, so i'm asking if there is any solution to avoid Unity to take a small pixel of other sprites, or if I have to reimport all my spritesheets with a blank separation between each sprites (i got a lot so i hope i don't have to...).
     
    Last edited: Jun 2, 2016
  2. ColossalPaul

    ColossalPaul

    Unity Technologies

    Joined:
    May 1, 2013
    Posts:
    174
    Hi,

    This is quite tricky to achieve (no buffer zone between sprites).

    But let me understand you more so we could get to the root of it.
    Why don't you have some buffers between your sprites? Why are they packed like that?
     
  3. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Hey, sorry but i come from web development and have always been using spritesheets like that (for saving maximum space as we can), I couldn't have known it will be a problem with Unity, and I noticed that only few days ago, but now I got more than hundreds of spritesheets in my project, so reimport the whole animations with a buffer zone between sprites and redo the whole slice stuff would take a lot of weeks =(

    EDIT : for info anti aliasing is set to false
     
    Last edited: Jun 3, 2016
  4. ColossalPaul

    ColossalPaul

    Unity Technologies

    Joined:
    May 1, 2013
    Posts:
    174
    Hi,

    It's just how video cards work. When the geometry requests for a pixel at uv 1.7394, it will have to 'round to some pixel' (in the case of point filter) and because it's a floating point you can't always fall on the right pixel.

    For the full story, take a look at this: http://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/

    For a short immediate fix, you also need to turn off anisotropic to off.
     
  5. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Thank you for the info, so there is no way to change that "round" to a "floor" system ?

    I forget to clarify that i already have deactivated anti aliasing & anisotropic, which looks better but isn't enough.

    About the pixel perfect link, I changed my camera Orthographics Size to 5.4, in order to keep a PPU for every spritesheet to 100 (then a background sprite of 1920*1080 fits perfectly with the camera). But actually i use to change this value ingame when i have to do some special zooms on characters, so adapt the ortographic size can't be the right way to fix the problem.
     
  6. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    @ColossalPaul one idea came in my mind : when I use the "Sprite Packer", all sprites are reorganized and it seems there are no artifacts anymore with same configuration, so could it be a reliable solution to avoid my problem without modifying each spritesheet one by one on my side ?
     
    Last edited: Jun 3, 2016
  7. ColossalPaul

    ColossalPaul

    Unity Technologies

    Joined:
    May 1, 2013
    Posts:
    174
    that's because the sprite packer enforces a buffer between all of the sprites. So you bleed into transparent pixel.

    You really have to calibrate it like in the blog link to make your original texture work. Which is quite effort intensive. The buffer between sprites makes everything easier
     
    theANMATOR2b likes this.