Search Unity

Question Repaint texture based on a specific source color leaving artifacts

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

  1. Danil0v3s

    Danil0v3s

    Joined:
    Sep 22, 2014
    Posts:
    45
    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:
    upload_2022-12-4_21-49-10.png

    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
    upload_2022-12-4_21-56-7.png

    The problem I've noticed is some textures leaving some artifacts and using the _ColorControl doesnt seem to help in this case...
    upload_2022-12-4_21-56-56.png
    upload_2022-12-4_21-57-15.png

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

    Danil0v3s

    Joined:
    Sep 22, 2014
    Posts:
    45
    I think I've got it working but the colors seem a bit too dark... Got it working this way
    upload_2022-12-4_22-28-49.png