Search Unity

White edge appears in psd file format

Discussion in 'General Graphics' started by h765643729, Jan 28, 2019.

  1. h765643729

    h765643729

    Joined:
    Jan 17, 2018
    Posts:
    21
    The use of psd files in unity3d will have white edges, but converting psd files to png format will not have white edges. I don't know why this is happening. Is there anything that is not set correctly?
    upload_2019-1-29_2-9-41.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Unity changed it's default handling of PSD files with background alpha to be broken. Or perhaps more accurately they stopped applying the hacky workaround they'd been doing for years to remove the white background and reverted to the default PSD plugin's handling of transparency. That default handling just happens to be terrible, though to be fair the old hack wasn't perfect either, it was certainly less obviously bad than the default behaviour.

    Basically the default handling of PSD files is to assume any PSD with background transparency should read the colors as if they're blended against a white background. This is the same behaviour you'll see in a lot of non-Adobe written professional software, even though it's never what is ever wanted. I have no direct insight into why they did this, but I'm assuming it was some kind of pressure from Adobe themselves.

    In older versions of Unity, or PSD texture assets that were imported using an older version of Unity, you would see this:
    upload_2019-1-28_12-7-45.png
    That link goes to this page:
    https://docs.unity3d.com/Manual/HOWTO-alphamaps.html

    Since some version of 2018 or so the default behavior for newly added PSD texture assets has been to not show the option or warning at all. You can hack around this for now by hand modifying the .meta file for the asset if you have them enabled on your project. If you open up the .meta for your asset in a text editor you should see these two lines near the end.

    pSDRemoveMatte: 0
    pSDShowRemoveMatteOption: 0


    You can set them both to 1 to bring back the option and enable the matte removal as a temporary work around, but I'd expect this feature to get removed entirely at some point.

    I've worked for companies using custom engines who have reverse engineered the PSD format and written their own tools for this to work around the problem because the official Adobe plugins are so worthless. So while I'm annoyed by this change, I can't blame Unity too much, especially if there's political pressure for them to not do it.
     
  3. h765643729

    h765643729

    Joined:
    Jan 17, 2018
    Posts:
    21
    Thank you for helping me.