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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 2D Sprite/Texture problem (Solved)

Discussion in '2D' started by JoKe90, Aug 19, 2015.

  1. JoKe90

    JoKe90

    Joined:
    Jun 10, 2015
    Posts:
    15
    Hello again.
    I have yet another problem... This time with sprites.

    I have made sprite sheet with 100x100 pixel blocks next to each other.
    Art is made with GIMP,. Sprites have mostly just one color making simple shapes, and everything looks fine until I export them to PNG and add them to Unity.
    In Unity I sliced the PNG in Sprite Editor using Grid 100x100. Sprites still look fine in Sprite Editor.

    But when I put them in Scene/Game, this happens... They have weird outlines and/or somekind of shading. Game view looks terrible...
    Why is this happening? What can I do?

    textureproblem.png
     
  2. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Hey @JoKe90, the dark areas should not be there unless you have something related to lights and shadows enabled.
    Can you attach the a sample project so that we can take a better look at your setup?
     
  3. JoKe90

    JoKe90

    Joined:
    Jun 10, 2015
    Posts:
    15
    Hi. I attached cleaned up version of my project, leaving only the sprite left.
     

    Attached Files:

  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    I had a look at the project. The filter mode of your tile texture is set to bilinear which would interpolate between neighbouring pixels to get the final pixel colour. This is not good for the edges of certain tiles as it would interpolate between coloured pixels and blank pixels, resulting in the lines you see between tiles.

    You can solve this issue in one of two ways:
    1. Disable filtering and anti-aliasing
      1. Change the filter mode of your texture to "Point"
      2. In Project Settings -> Quality, set Anti Aliasing to "Disabled"
    2. Extrude the edges of your tiles by 1 pixel
      1. A simple way to do this would be to apply a packing tag to your texture so the sprite packer can automatically extrude your packed tiles.
     
  5. JoKe90

    JoKe90

    Joined:
    Jun 10, 2015
    Posts:
    15
    Thanks! I used the first way to solve my problem, because I think that I don't need antialiasing for simple sprite/tile based game.
     
  6. BlackManta

    BlackManta

    Joined:
    Nov 21, 2014
    Posts:
    7
    Thank you so much! This was driving me batty