I’d like to help anyone who needs a switch on int node but for materials.
The scenario is this - you have 1 or more textures that each channel is separate grayscale texture (for example you use the RGBA channels to store variations of a mask).
Here’s how to use it:
You need to create two material functions
- MF_MultiSwitch: This is the function that should be called in the material.
- MF_alphaBlend: This material function will be used in in the MF_multiSwitch to filter whether to allow the current scalar texture to pass through or not.
Note: this can also be used with whole textures (RGBA), you just need to change the inputs for the material function to be vector3 or vector4 depending whether you like to use the alpha channel or not.
You can find the project zipped here [switchonint.zip]