Mapping Multiple Materials to an Mesh based on Texture Masks?

I have noticed that the default mannequin uses a setup where one texture uses the R, G, and B channels to map 3 materials onto the object. How would you expand this to support more than 3 materials?

At first glance, I would think that you would just have to use more texture maps. I.E.

Texture 1 R = Material 1
Texture 1 G = Material 2
Texture 1 B = Material 3
Texture 2 R = Material 4
Texture 2 G = Material 5
Texture 2 B = Material 6

The reason I am doing this is because I want to make a dynamic system where the following is possible, after the above is setup. Each texture slot…in this example 6, will be dynamically assigned a Material at runtime, and each Material will accept parameters at runtime. This will allow me to now only select different material presets for each section of a mesh per character at, but also assign parameters to each Material.

This may sound a bit overkill, but I will be only using this technique on less than 10 meshes simultaneously, and normally not more than 2.

If there a better way to do this? The other way I thought about doing it is using a single paletted texture, and mapping each color to one material, but I haven’t seen any example of doing that, I think the example materials all use channel->material style mapping, not color->material.