Trouble with applying 4 Materials via GLSL Nodes

Hello everyone,

Wanted to post here with a question that I’ve been trying to figure out but haven’t been able to find a solution to, whether through experimenting or through searching. I don’t know if this should be in this section or the Game Engine section, since it technically applies to both, so hopefully I got it right :).

Anyway, here goes :slight_smile:

I’m trying to get a setup in Blender’s Game Engine, via GLSL, where I can have 4 materials blended on a model using a RGB color mask. I have the setup for the 3 textures applied via the R, G and B, but I’m completely stumped at working the 4th texture in there.

I tried setting up a 4th network using Black as the “factor” to control whether it shows the 4th texture or the other it’s “mixed” with. But that’s not working. It just paints in one of the already existing materials instead.

I’m thinking it might somehow need to act as a “base” texture that underlies everything and then gets painted over by the other materials. Not sure on that, though.

If anyone can provide some help on how I need to set up the nodes to get that lonely 4th texture/material at the bottom to work, that would be awesome.

I’ve attached/linked a shot of what I’ve got so far, and an enlarged shot of my node network. The Geometry nodes are bringing vertex colors into the mix for more variety. I scrunched things down in the larger node pic so I could zoom in to make the nodes as legible as possible.

Any help is appreciated!


If you had RGBA file you could have had 4 channels; each can hold separate mask.
Here’s Mike Pan’s blog article on that. Do not miss this site too.

Edit:Probably scratch this, your’e using Game. Still, maybe some custom shader can help, idk much of Game though.