Color swap shader

Hey,

I’ve found a lot of threads around applying color to a greyscale image, or swapping colors of a pixel art palette, but neither of these achieve quite what I’m attempting… and I’m really just trying to establish if it is possible, or if I should try a different solution.

I’m trying to achieve an effect like this

… where a range of colors is replaced with another when under a mask. I was thinking I could supply a shader with two ramps, and it finds the coords of one color, and looks up the replacement color.

Is this possible? Or would I be better off rendering two identical scenes and using a render texture for the masked area.

Thank you so much.

Yes, one shader can do all you need. Just lerp between the two ramps based on your mask.