Search Unity

PSD vs PNG graphic issue

Discussion in 'General Graphics' started by deadlyshadoff, Jul 21, 2018.

  1. deadlyshadoff

    deadlyshadoff

    Joined:
    Jan 23, 2016
    Posts:
    15
    I am not sure if this is the appropriate thread, but I found that if you convert PSD to Sprite small white stroke appears. PNG doesn't have this issue.

    Unity 2018.2.0f2
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    The issue is how Photoshop treats fully transparent pixels when using layer transparency. When a photoshop layer is fully transparent the RGB color values are erased, and set to white internally. When Unity reads the PSD, it just gets the color values the PSD has. When that texture is rendered on the GPU using bilinear filtering, the result is what you see as the texel color is interpolating to white at the same time as fading out.

    There are several solutions. The easiest is to check the “Alpha is Transparency”. This will have Unity do a dilation pass to copy the RGB color values of the visible pixels next to fully transparent pixels. Photoshop’s built in PNG saving does a similar thing, though it does large blocks and streaks of solid color to try to optimize PNG compression, the result of which is if your image has a varying color values on the outside edge, there’s a chance to get similar artifacts, which again Alpha is Transparency should solve.

    The more in depth solution is to not rely on layer alpha, and use a separate alpha channel in your PSD. This is what you would need to do if you actually need to retain the color values in areas of full transparency, like when making a metallic gloss map, but that’s unnecessary for this case.
     
  3. AkiraWong89

    AkiraWong89

    Joined:
    Oct 30, 2015
    Posts:
    662
    For me, I never use lazy way for importing graphic files. I use either PNG or TGA instead of PSD directly. Export separately and manually if needed. Including 3D files, I use only FBX or OBJ, never importing MAX, MB, Blend etc. directly. For professionalism and also safety purpose.
     
    Ryiah and deadlyshadoff like this.
  4. deadlyshadoff

    deadlyshadoff

    Joined:
    Jan 23, 2016
    Posts:
    15
    @bgolus @AkiraWong89 Thank you guys for info. I simply decided to use PNG files.

    I made this post for people who will have this problem and won't understand what cause of it.
     
  5. Subhojit

    Subhojit

    Joined:
    May 17, 2014
    Posts:
    9
    Hi @deadlyshadoff,
    I am having same issue with PSD file. When I am using directly into Unity as sprite. Any fix does you know? I am using Unity 2018.2.20f1.

    Capture.PNG
     
    Last edited: May 8, 2019