Search Unity

Metallic + Occlusion + ?

Discussion in 'General Graphics' started by dragriff, Jul 13, 2019.

  1. dragriff

    dragriff

    Joined:
    Oct 22, 2015
    Posts:
    39
    Hello, I recently discovered that, when using a Metallic map, Unity only uses the R(Red) channel from the texture. Also, if you have an Occlusion map, it only uses the G(Green) channel. The Alpha channel, of course, can be used for a Roughness map.

    So, from what I can gather, you can combine these textures into a single one, thus saving up on memory, correct?
    My questions are:
    Is this generally a good practice, or are there some drawbacks to it?
    Also, by using these types of textures, the B(Blue) channel of the texture is not used, and I have no idea what it could be used for. Can someone tell me if something else could be put in the Blue channel of the texture?

    Thank you
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    It is good practice.

    The draw back is some additional artifacts in the metallic and occlusion maps. Metallic maps are generally going to be sharp changes between white and black, and occlusion tends to be more subtle gradients. In the areas where there’s an edge in the metallic map and detail in the occlusion map, expect both to suffer. Most of the time it won’t be a big problem, but it is something to be mindful of.

    Some custom shaders will put the texture’s height map in the blue channel, though the Standard shader uses the green channel. This is most common with terrain or other multi-texture blending shaders rather than explicitly for parallax offset effects like what the Standard shader uses it for. Plus there’s some mismatch there where occlusion and Metallic tend to be sRGB, but height should be linear. (Though neither metallic nor occlusion need to be sRGB, as any values but black or white in the metallic map aren’t physically plausible values, and occlusion just comes down to what you think looks good.)
     
  3. dragriff

    dragriff

    Joined:
    Oct 22, 2015
    Posts:
    39
    Alright, thank you for the info!

    Also, I just recently found some info saying that the blue channel could be used for a detail mask. Correct me if I'm wrong on that.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    With a custom shader, sure. Or a b&w emission mask, or even the smoothness map (forgoing putting it in the alpha as an RGB texture uses half the memory of an RGBA when using the default PC GPU compression formats).

    Really, any arbitrary data you want to store can be stored in that channel with a custom shader.

    But the built in Standard shader never samples the blue channel by itself.