Search Unity

How to optimize when using same shader but different Metallic values

Discussion in 'General Graphics' started by AnthonyPaulO, Nov 7, 2019.

  1. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    I have textures that use the same Standard shader in opaque rendering mode, but each texture has different metallic values. Naturally I'd like to use a single material but different metallic values means I have to have a different material for each value. Is this as good as it gets or is there a trick I'm missing? I thought of perhaps hijacking a few bits off the green color from the textures to represent the metallic values and create a custom shader that can extract the metallic value from the green channel, but there may be a better way.

    Any thoughts?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Why not use a metallic texture?
     
  3. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Ahhh... thank you, it’s been so long I forgot a metallic texture map could be assigned. Unfortunately the bundle I purchased came with each texture assigned specific values rather than a metallic texture map, but that’s beside the point, you answered my question. A texture atlas of metallic textures would solve the draw call/batching issue. Thanks bgolus!