Multi Selection Static Switch

I have a material that i’m using on multiple objects and for the sake of efficiency i’m using a 4 channel texture to supply masks for different objects that use this same texture so that i can get decent UVW density without having a huge texture. in order to swap between the channels i have 4 nested static switch parameters. this is ugly and somewhat annoying to use.

is there a multi input (ideally some form of number roller) switch that i can use to select the channel or do is my current method the best?

i think that’s pretty much what i was looking for. unfortunately you can’t uncheck all channels to get black like i could on my setup but it’s definitely simpler.

There is a component mask switch parameter. It is exactly suited for this purpose.

My solution to this problem was to use if nodes. You can chain together as many as you need to create as many inputs as you need. So for example, in my blueprint all I do is set the float value of my scalar parameter with an integer. The parameter is then compared to a constant to determine which input on the if node to use.

1 Like

Thanks for the pic.
I’m from 2023 and UE4.27. Your lines were unclear, and it gave me an error unless I plugged in for A > B. So I put a 4.

So for everyone here is a clearer pic:

This code lets you make many Instances (copies of Master Materials), that you can individually select the texture set, then chose which channel of the texture, to use as “Emission Channel:”
0 = R channel, 1= G, 2 = B, 3 = A.
4 = full glow on some textures.

So for one set, I had a texture with Emission as the Alpha channel (code 3 in this pic).
But another texture set had Emission as the Red channel (code 0).

So this code lets me reuse the same Master Material, and only change the texture sets, then select the Channel to use for Emission. It is like the Mask node - selecting which channel to use of a texture, but I can select as a Variable (#multiswitch) in Mat-Instances.

You can use ChannelMaskParameter.

Can you post an example code pic? Ty.