Need some help for using color-id maps

To clarify: color-ID map where i have a texture for my mesh where different materials (or just variation in roughness for example) are represented by different colors. I’m a beginner when it comes to materials and not good in visual scripting in general, so please explain it in details or screenshots :).
The only topic I found in the docs about this kind of problem was layered materials, but I assume for simple things I wouldn’t need to use material function, and I was able to mix two materials at most at once. By simple I mean just to have different roughness/metalness at different part.

Case 1

I have RGBA color map where at each channel every vertex is either 0 or 1. I want it to generate a proper roughness map where for example value 1 on the red channel will be 0.2, the green 0.4 the blue 0.8…

Case 2

the same thing as above except with any kind of color: different shades of blue, orange, brown etc… could it be done at all?

Case 3

would like to have an easy example of using layered materials. I could use one channel, red for example to blend two materials but how can i blend more than two? and Is it a good idea to blend materials at all if I just want separate materials at different parts? I read that usuallyit’s better to have different material slots on my mesh,and probably will do that, but still would like to know theanswers on these questions.

Thanks in advance!

For question 1 I found this video:

In the second half it’s setting up a color id map to generate a roughness map with lerp nodes. (only thing is that the vector3 constants are unecessary, simple constants will do).
I don’t know if it’s the best way, so more input is appreciated.