Search code examples
unreal-blueprintunreal-engine5

How do I mix different channels without the colors affecting one another?


I'm trying to set up a Material that I can set the color of each channel individual through a color mask. I figured that much out however I'm trying to add them back together.

It will work initially however when I change the color of one channel it will start to affect the others.

I can't seem to find a node that will allow me to mix these different channels together.

enter image description here


Solution

  • I don't have Unreal available at the moment, so I can't give you a screenshot, but I try to describe it.

    Instead of multiplying the color, you could just use a Linear Interpolate node to combine them one by one.

    You plug the result of Mask(R) into a Linear Interpolate node as its Alpha. You then plug the color you want the R channel to be into B. You then create the next Linear Interpolate node and plug Mask(G) into Alpha and the result of the first Linear Interpolate into A, the color you want the G channel to be into B. Proceed with the next node until everything is covered.

    How does this work?

    Linear Interpolate uses linear interpolation to map the values between 0 and 1 to whatever you plug into A and B. You can think of the Linear Interpolate node as a filter for a mask. If you want to combine two shapes onto another, you plug your mask-input into Alpha and everything in B will be seen instead of A when the mask is 1. You can read more about this in this article. You will find a lot of essentials under "Math Signed Distance Fields - COMBINE, BLEND, AND MASK SHAPES".