Search Unity

Bug Replace Color node is broken

Discussion in 'Shader Graph' started by Sinister-Design, Dec 17, 2020.

  1. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    66
    This screenshot speaks for itself, I think. The From color in the Replace Node in Shader Graph was chosen by eyedropper-ing a big chunk of the character sprite's purple cloak. As you can see, absolutely none of it is replaced with neon green.

    (Note: I can get parts of the cloak to start turning green if I up the Range value, but it starts with the wrong color, replacing a lighter shade than the one specified in From!)
     

    Attached Files:

  2. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    121
    Works fine for me. It's all about setting up the right From/Range/Fuzziness values.
    upload_2020-12-19_0-27-35.png

    But since it works based on distance between colors in RGB color space, the results may not be very intuitive, and especially since you want to replace colors of varying hues and lightness, not entirely desirable. For replacing colors in this particular case I would recommend using a separate texture as a mask to select the exact areas for color replacement.

    You can also try a setup like this to replace colors based only on hue, it's simpler than making a separate mask, but it still may not always produce the desired results.
    upload_2020-12-19_0-45-52.png
     
    Olmi and florianhanke like this.
  3. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    66
    Yeah--turns out, I was still using a version of URP where this node type was simply broken. Updating Unity fixed the issue.
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    which version of unity works?
    (it's like a treasure hunt)
     
  5. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    66
    I'm using 2020.2.0f1 and it works in that!

    Note: you'll also have to update the URP, most likely.