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

Efficient icon resize

Discussion in 'General Graphics' started by CptBertorelli, Apr 15, 2020.

  1. CptBertorelli

    CptBertorelli

    Joined:
    Apr 9, 2020
    Posts:
    20
    Hello,

    I have 256x256 .png icons. However in my game I need them to be smaller. After applying desired size (or scale) in transform in sprite they do not look good. I clearly see pixels. Could you please share what is the best way to resize them? Do I need to use some graphic application like Photoshop or is there a good way to accomplish that in unity?

    Thank you in advance
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,256
    What you’re seeing are the artifacts of mip-mapping.

    Scaling them in Photoshop or Gimp to the exact size you need will be the highest possible quality, but rarely do you only need one exact size.

    I posted an example work around on how to use a custom shader on icons to keep them significantly sharper at the cost of a slightly more expensive shader.
    https://forum.unity.com/threads/how...-and-crisp-even-while-rotating-solved.651841/

    And wrote a whole article on why.
    https://medium.com/@bgolus/sharper-mipmapping-using-shader-based-supersampling-ed7aadb47bec
     
    rayleigh231 likes this.
  3. CptBertorelli

    CptBertorelli

    Joined:
    Apr 9, 2020
    Posts:
    20
    Thank you for such detailed answer.

    I read your post and also article. However as a beginner in game development I only have limited understanding of that matter.

    Also my case is very simple: I have a 2D Sprite Renderer that has a 256x256 png set as Sprite. I applied scale of 0.2, 0.2, 1. Could you please say exactly what do I have to set in order to make my sprite look better?

    upload_2020-4-16_13-29-19.png
    upload_2020-4-16_13-29-30.png

    In normal scale it looks fine:
    upload_2020-4-16_13-29-54.png

    Thank you in advance for help
     
  4. CptBertorelli

    CptBertorelli

    Joined:
    Apr 9, 2020
    Posts:
    20
    I also tried different options on my texture (point, bi and trilinear), size and compression. In spite of that my file resized in photoshop still looks WAY better. Do I miss anything? Maybe some specific project options?
     
  5. Bingo77

    Bingo77

    Joined:
    Apr 16, 2020
    Posts:
    1
    Hey! I've tried method described above and it helped, thank you!
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,256
    The forum post and article I posted are about how those filtering options aren’t enough to get good sprite scaling and you need a custom shader to get something closer to what you see in Photoshop.

    However it also looks like your sprite asset doesn’t have mip maps enabled.
     
  7. CptBertorelli

    CptBertorelli

    Joined:
    Apr 9, 2020
    Posts:
    20
    Thank you for help.

    Another problem that came up recently is that some textures got the 'POT' problem:
    upload_2020-4-25_13-17-14.png

    What does it mean? How to fix it? It lower quality of these sprites considerably.

    Thank you