Vertex Paint Shader

Hi everybody!
I am trying to create a shader with ability to add additional textures based on vertex color.
I am forced to use WorldAlignTexture because the models i am using don’t have UVs.

Based on tutorials i have got it working, but the problem is that it is set up now to lerp one channel after another in certain order.
So then i paint red channel i can paint green channel over it, and blue over red and green. But i cant paint red over blue or green to replace it.
Maybe there is another way to set up this, so all channels will be replaceable during the painting process?
What i want to achieve: start painting in one channel and then you can paint in any other and it will replace first one. I dont need any kind of fancy blending in-between.

Or maybe there is a more appropriate way of setting this kind of shader?

Here are screenshots:



Thank you!

it is possible, but you will most likely end up with artifacts of the “first” color coming through between the other colors.
you’ll have to subtract the other channels from the one you want to use as a mask. clamp the result before feeding it into the lerp though.

but like i said, you will end up with the base color coming through between colors. can be worked around by using a hard edge between colors and with a mask for that edge it may even work for most styles.

Thanks Divi! Will give it a try!