Search Unity

Question why the texture's channels look different in Photoshop and Unity?

Discussion in 'General Graphics' started by Cenly, Aug 6, 2022.

  1. Cenly

    Cenly

    Joined:
    May 30, 2022
    Posts:
    16
    In ps,the red channel looks like:
    upload_2022-8-7_1-50-13.png
    But in Unity,
    upload_2022-8-7_1-51-1.png
    and actually r channel should save glossiness map.
    upload_2022-8-7_1-51-57.png
    They have troubled me for hours, I cant sleep without solving my problem TAT
    And things are more complex than my discription. Actually I have three textures and some show the right color in Photoshop( like the third pic) and some show the false color like the first one. But they all show right in Unity except the red, green, blue color.

    I'm insane. I even start to search the different between DXT1 and DXT5 and find nothing.
     
  2. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Your channel in photoshop seems to have transparency. However, photoshop handles transparency without an explicit alpha channel, which Unity needs if you want transparency at all:
    https://www.lmhpoly.com/tutorials/how-to-create-transparent-texture-for-unity

    So your red channel looks identical in Unity and Photoshop, minus the transparency: semitransparent white in PS is pure white in Unity, and semitransparent black in PS is pure black in Unity. (Note that the preview window in Unity tints the R channel red, the G channel green and the B channel blue, so pure white shows as red, green or blue depending on the channel).
     
  3. Cenly

    Cenly

    Joined:
    May 30, 2022
    Posts:
    16
    Thank you so much !!! Get it ! So if the pic has alpha channel, the result showed in explorer, photoshop blends each channel with alpha channel and present transparency effect 'cause they treat that as defualt? But I can choose if "Alpha is Transparency" in Unity !!
     
  4. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Not an expert on the subject, but I believe if you want transparency in Unity you need to create an explicit alpha channel in Photoshop, so you'd have 4 channels in Photoshop instead of the usual 3. See the link I shared.

    Photoshop seems to have its own per-layer transparency, which is not the same as an alpha channel for the entire image.

    When you choose "alpha is transparency" in Unity's import settings, Unity interprets the contents of the alpha channel as transparency.
     
  5. Cenly

    Cenly

    Joined:
    May 30, 2022
    Posts:
    16
    I saw the link and learnt a lot. I don't want to creat a transparent texture, I just collect textures from web or game resources to reproduce cel shading. The "light map" or so called "shadow map" have 4 channels playing different roles, and I ues each channel separately.

    Additionally, after long time search, I find all becasue of PNG format!! png8 includes 3 formats: opaque,索引色透明(index transparency?I don't know how to say), alpha transparency,......

    All in all, only with plugins can PS separates alpha channel from PNG. And this link tells a way to get alpha channel transparency value of a pixel.

    I'll ues .TGA format (crying).
     
  6. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Unity accepts .psd files just fine, its easier to work with them imho. You can just open up the psd file in photoshop, modify it, go back to unity and it gets updated automatically. Works with an alpha channel (transparency) too.