Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Repaint texture based on a specific source color leaving artifacts

Discussion in 'Shader Graph' started by Danil0v3s, Dec 4, 2022.

  1. Danil0v3s


    Sep 22, 2014
    Hi guys, I'm trying to reverse engineer a shader for learning purposes and that said shader should be able to take a texture with a specific color (green) and change it to whatever else. I could get it working but for some textures it doesn't behave so well on the masking part and I can see some artifacts on the final mesh

    I've noticed the source materials have 10 color properties:

    • AlphaBody
    • ChangeColor
    • ColorBack
    • ColorControl
    • ColorParam
    • HighColor
    • LightMapColor
    • LowColor
    • LumiColor
    • Param
    The input textures are all something like this, with the same shade of green:

    I've noticed that the materials have the _ColorControl color set to some shade of pink/magenta so I tried:
    1. Color Masking that _ColorControl with the _MainTex
    2. Replacing Color from Black to a Blend between _HighColor and _LowColor
    3. I multiply the result of Replace Color with the original texture

    The problem I've noticed is some textures leaving some artifacts and using the _ColorControl doesnt seem to help in this case...

    I'm out of ideas and I my shader knowledge is little to none. Could you point me in the right direction?
  2. Danil0v3s


    Sep 22, 2014
    I think I've got it working but the colors seem a bit too dark... Got it working this way