Home Unity

(Solved) [Channel Packing] Should I store RG channel of normal map to AG channel on export?

polycounter lvl 6
Offline / Send Message
bitinn polycounter lvl 6
Hi,

I keep hearing people say if I don't import normal map as normal map in Unity, I will see some quality lost to normal data.

As far as I know, this is caused by texture compression and each channel have different number of bits, so Unity shuffle channel on normal map import to get better precisions.

Question is: If I import a PNG file where I use AG channel to store normal data to begin with, don't tell Unity it's a normal map (and import it as linear texture), but use shader to reconstruct normal data at runtime. Does it still suffer from the same quality lost?

Thx in advance!

Replies

  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Another question: If I want to use the Alpha channel of my Albedo texture for something else (non-transparency), is it still safe to import texture as sRGB?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    I would assume normal map compression uses BC7, while the standard compression uses BC1, so yes, there is probably a little bit of quality loss, still.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    To the second question, logically, your alpha channel gets srgb'd too, but it shouldn't be a big deal, because simply applying power of 0.4545  on your alpha channel content puts it back to linear. And applying power of 2.2 makes linear color things srgb.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Obscura said:
    I would assume normal map compression uses BC7, while the standard compression uses BC1, so yes, there is probably a little bit of quality loss, still.
    Thx for both of your replies.

    Actually Unity appears to use BC7 for everything if you select high quality compression. I am not aware of special treatment for normal map. So no difference I guess?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    One more thing that could come to my mind, is the range of values, but I'm not sure if this is handled inside the shader, or driven by a compression setting in Unity. Normal maps needs 1,-1 range, so possibly the normal map compression applies this range on it. In that case, not using the proper compression setting would result in incorrect shading, not quality loss. But because I'm not a Unity user, and I base what I write here on Unreal, you should check it yourself. Though you could store them in 1,0 range and stretch it out in the material by multiplying it by 2 and then substracting 1 from it. 
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Obscura said:
    One more thing that could come to my mind, is the range of values, but I'm not sure if this is handled inside the shader, or driven by a compression setting in Unity. Normal maps needs 1,-1 range, so possibly the normal map compression applies this range on it. In that case, not using the proper compression setting would result in incorrect shading, not quality loss. But because I'm not a Unity user, and I base what I write here on Unreal, you should check it yourself. Though you could store them in 1,0 range and stretch it out in the material by multiplying it by 2 and then substracting 1 from it.
    I believe this part is handled in my shader nodes. But good to have that in mind.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    I am just adding a reply to say alpha channel ISN'T affected by the sRGB setting, it's always linear (I don't know if it's a Unity/Unreal only feature, but both seem to support this.)
Sign In or Register to comment.