Home Technical Talk

Is there any difference at all between R, G and B channels?

joaokalva
polycounter lvl 3
Offline / Send Message
joaokalva polycounter lvl 3
Context: I want to create a shader in Unity with the metallic workflow to keep the AO, Metallic and Roughness map in one single RGB .jpg map

However, I have trouble to decide which texture should be in each channel. I don't think there would be any difference, but it gets me wondering, for instance, why it is named RGB, and not GBR. Is it simply an arbitrary choice or is there some logic behind the order R, G, then B?  Does the order have any kind of impact on the processing of the textures? Thank you.


Replies

  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    You might not want to use jpg if you prefer to get the highest possible quality.
    Also note that the game does not use the jpg format. It does use whatever you set in the image compression settings 
    And finally these compression formats might indeed use different compression settings for the different channels. You can find out by asking the internez about them. 

    Ahh the internez did came to you..
    https://docs.unity3d.com/2019.2/Documentation/Manual/class-TextureImporterOverride.html
  • joaokalva
    Options
    Offline / Send Message
    joaokalva polycounter lvl 3
    I wouldn't really mind going beyond 8bits for the AO, Albedo and Metallic, so that's why I think .jpg is worth the fit (but for the Normal Map it's a different story)
    And since, like you pointed out, everything is compressed in the end, are two file formats with the same bit-depth and same channels going to have a different output in the end? (From the link it seems like it doesn't take into consideration the file format when compressing)

    Perhaps the only difference of using different file formats in this case, where the bit-depth doesn't have to go beyond 8 bits and the channels are the same , is the file size, which still shouldn't change the impact on the game because they all would go under the same compression, right?
  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    Depends on what your jpg compression level looks like. If I don't have to care about the file size and want maximum quality I go with png. Otherwise you might want to choose another import format like jpg if it fits your needs. 
  • joaokalva
    Options
    Offline / Send Message
    joaokalva polycounter lvl 3
    Gotcha. Thank you for the replies
  • Eric Chadwick
    Options
    Offline / Send Message
    Best bet is to author in uncompressed and let the engine do the compression.

    Depending on the compression, different channels can get compressed differently. Gets a bit technical, but you can dive into it here http://wiki.polycount.com/wiki/Normal_Map_Compression
  • Farfarer
    Options
    Offline / Send Message
    As mentioned, use lossless formats for authoring textures (PNG or TIFF are most common if you want compression and 16bit precision). The engine will handle compression. Never use JPEG for anything except uploading to the internet.

    All of what follows varies depending on the exact compression method used but generally holds true for "standard" colour texture compression.

    There is a slight difference in the channels. The green channel is usually slightly higher precision than the red and blue channels (red and blue get 5 bits of data while green gets 6 bits, making a nice ring 16bits for all 3 together - that plays nicely with memory access). Alpha generally gets a full 8 bits.

    The reasoning being that human eyes are most sensitive to green light so if you need to split 16 bits across 3 components, green should be the one that gets the extra bit.

    So best to store the map that needs the most precision in the green channel (likely the roughness map).

    Oh, and the ordering is probably based on the wavelength of the colours.
Sign In or Register to comment.