How I can choose the needed color from texture?

I have seven color texture mask.
309649b7970b9c9e2351d817030cf82e3cabf096.jpeg
How I can choose the needed color from texture? Colors in my texture mask can be variously. I need select needed color from final mask, seven color min.

use just the RGB and their output in the material node
or
reference youre topology with seperate UV masks for those “continents”.

hmm… IF there are seven colors… what would be an optimal way to separate them in the material editor…

I would do some combination of multiplication and if nodes. Multiply R * G for example, and that value will be zero for everything except Yellow and White. This assumes all of your values are either fully off or fully on - this strategy won’t work for the orange color in that map, since it’s (1,0.5,0), so I’d use an if node to separate out those 0.5 values.

So I was rather bored and felt like goofing off.
Its far from perfect, and needs optimization… but its a start :stuck_out_tongue:

That Youtube video isn’t working.

Very odd, works fine on YT self: UE4 - SuperMask Material function WIP - YouTube

It’s working now, are you just clamping those particular colors? I wonder how much more expensive it is than doing using a 5 layer mask with RGBA.

Way I did is is very hacky/crappy.
Its almost always better to combine three alpha channels back into a seperate RGB channel though, alpha’s result in much bigger filesizes.
If I have some time I’ll see if I can make a very optimized one and see if its worth it complexity wise.

Finally had some time to optimize it, I’m sure there are better ways on doing this, and could be optimized even further… but hey :slight_smile:
Ill upload the file tomorrow or so.

Sorry for the massive delay.


That for RGBCMYK colors. Avoid the White color because is the sum of others.

If you need more colors, you can convert the image before to grayscale 0-255 and use the method explained by Ryan Brucks here:

1 Like

Thank you for this. Maybe I was searching the wrong words but it took me a while to find something useful. Since I’m here and we have those shiny new Named Reroutes in UE5 now, here is an updated version for a bit more clarity. I removed the Bias Scale since I’m only using maximum added vertex colors on meshes - it might be a nice to have for textures though, but you should add parameters for control.
EDIT: Give those masks a Cheap Contrast = 1. I still had overlaps with those masks - looks black but it isn’t! Took me a while to get that.