Search Unity

Smeared textures when it should be pixel art

Discussion in 'General Graphics' started by deLord, Feb 7, 2019.

  1. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Hi there

    I use Tiled to import a tilemap to Unity. The imported spritesheet looks fine, filter mode is set to point (no filter), quality settings I selected fantastic, but yet, ingame the textures are smeared as hell.
    Moreover, the tiles do not perfectly overlap and even although I set the camera to "Clear Flags : dont clear", I get these huge pixel lines between my tiles, why is that?
    spriteQuality.png

    spriteQuality2.png
    ^ Project Quality settings

    on mobile.jpg
    ^ how it actually looks on mobile. There isnt even anything green or yellow behind the "bridge" ô.O wtf

    Any help is greatly appreciated :)
     
    Last edited: Feb 10, 2019
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Did you turn off mipmapping in your import settings? Mipmapping could potentially cause both of these problems.
     
  3. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    oh god, now I found it.
    The compression "max size" was set to 2048, when in fact the source image is 2048*3040.

    That actually solved both problems.

    But now I realize it only solved them in the Editor. On my phone I still have these weird lines. Texture compression is set to "dont override" so I wouldnt expect him to change the settings.
     
    Last edited: Feb 7, 2019
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    You may not have noticed, but the compression settings are per build platform (see the button bar on the top right corner of that little compression settings box). You may have changed the settings for "desktop" but not "android".

    Edit: also, not sure if this is part of the problem but it's always best to avoid non-power-of-two textures (especially on mobile). You might want to divide the image in to one 2048x2048 and one 2048x1024 textures.
     
  5. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    hmmm that wasnt it. I changed to "Override for Android" and set it to 4096 but it still looks the same on mobile.
    The thing is, this spritesheet has already been used in all my levels (using Tiled to create them) and splitting this imagine how you described (which I should have done earlier, yes) would now most likely be lots of repainting work.
    But do you think that this would actually be the reason why this only looks like this on mobile? Any ideas which other settings could be the reason?
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    You also turned compression off and set filtering to "point"?

    I'm not certain, I was just suggesting that as something to try and see if it helps. Unity may resize textures so that they fit into some power-of-2, as it's required for some hardware. I don't know how Unity handles that.

    Another thing: Check the quality settings too. I think there should be separate settings for Android there, too.
     
  7. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    where would you find that?
    The only compression settings I can find for textures are on the textures themselves

    I found that if I turn on the "pixel snap" setting in my Tiled2Unity Material, I even get the seams on my computer.
    Moreover, if I use a spritesheet that is POT, there are less problems. But still, when moving, there will be black lines drawn between the tiles sometimes.
    So definately part of the problems seem to be non-POT images. Although I dont understand why that should be any problem if there is no compression anyway
     
    Last edited: Feb 10, 2019
  8. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Quality settings? Edit/project/quality settings.
     
  9. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Yes, but which settings there are specific for Android? I turned off AA and Anisotropic filtering already
     
  10. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Now I tried to set up everything with the new Unity Tilemaps.
    It is exactly the same result. The texture is only 1024x1024, no AA, no filtering.
    Someone please tell me that the Unity team came up with a solution for this already :/

    I noticed there are some tiles that tend to be more prone to this kind of phenomenon. In my tileset that is reproducable. Any comments on that?
     
    Last edited: Feb 12, 2019
  11. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    deLord likes this.
  12. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Thank you very very much for this video. I am not sure yet if I will use this solution though.
    If that's the only solution (I cant believe Unity doesnt already fully support that, everybody knows this bug) I think I will have to take the bitter pill and redraw all my tiles. Sounds just too wacky for 2019 tbh :D
     
  13. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Yeah, this is something to do with how some graphics hardware calculates u,v coordinates or something. I've encountered the same problem working with GameMaker and Flixel as well. Even when I tried to write my own OpenGL renderer.

    before you manually redraw it, try using the built-in Sprite Atlas feature. It looks like you may be able to add padding to the resulting atlas (That way, Unity will do the work for you). I've heard about this feature but haven;t tried it for myself just yet.
    https://docs.unity3d.com/Manual/class-SpriteAtlas.html
     
    deLord likes this.
  14. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    The bitter pill doesnt taste great (takes quite some time to redesign the sheets and levels) but it is the only solution I could get working. Luckily I only had 6 levels ready :X