Different Textures on Objects unsing the same Material with Control over Textur Color in Shader

Hi,

I’m working on a Keyboard. I created the Textures for the Keys with a alpha Channel so I can cotrol the Colors for the Textures and the Keys in the Material Shader. The Textures are UV-Mapped to one Face of each Key.

My Problem is, that I currently load the Textur from inside the Shader Node, to use it’s alpha Channel to Mix the Colors. Because of that, every Key has it’s own Copy of the Material Shader.

I would like the individual Keys to share the same Material Shader, but still having different Textures that i can use for changing the Material and Texture Color for all Keys at once.

Is there a Way to do that? It would really help me out.

Thanks for your Attention.

Best regards

Nils V

There are a couple of different nodes that could help:

image

You can use the Color value from the Object Info node. This will give the color that’s assigned to the object in it’s Viewport Display value.

The Attribute node can be used to get the color from a Color Attribute that’s been painted in the Vertex Paint mode.

Many thanks for your reply, please be patient with me if I don’t understand everything, the last Time i used Blender was as Blender 2.8 was new.

I spend a lot of Time creating the Image Textures for the Keyboard and it drove me closely to insanity to get them all matching. I would prefer a solution where i can, for example, assign the Textures to the individual Keys but still be able to Change the Color from a Material Shader that all Keys share, using the alpha Channel of the Textures, like in my Screenshot.

Yeah. I just re-read your question, and I was reading it upside down the first time. :slight_smile:
My suggestion was for if you wanted each key to have a different color.

You can use a node group to get a ‘shared’ node across multiple materials.

If you select the two color nodes, and the mix node, then press Ctrl-G, it will create a group:

You can press Tab to get back out to the full shader view. You can give that group a new name, and reuse it in your other materials:

As it is a single entity, when you make a change to it, the change will happen in all the places that it’s used.

You can add it to the different materials using the Group item in the normal Add menu:

image

Many thanks again,

can I use the same Method the other Way around, One Material using different Textures for each individual Key.

What I need is a Way to change the Material for all Keys at once, preferable in the Material Menu. So when I next Time, for example, need a white Keyboard, I just have to Change the Material Color, adjust the BSDF settings and change the Texture Color to black, at one Material for all Keys.

Preferably in a easy standard way, Blender Users expect. Because others have to be able to use and adjust them as assets.

If you try to use multiple textures in the single material, there needs to be a way to select between them.

By using a group for the ‘common’ things, you will only need to edit the group once and it will apply to all the different materials where it is used.

When you want to change the color scheme, you can go into any of the materials and click on the icon in the top-left of the group:

image

That puts back into the group to edit it. Changing the colors in there will aftect all of the different places that it’s used.

You don’t need to limit the group to just those three nodes. It could have the complete shader node setup, apart from the mask image. Then you would create as many materials as you have masks, and drop the group into them to complete the shader.

An alternative would be to adjust your mask image.
You could put all the keys in a single image texture, and adjust the UVs to map the keys to the correct part of the mask.

That’s going back a few steps from where you are now, but it would simplfy the material, and allow one setup to apply to all of the keys.

Ok, I think I understand it.

Many thanks again for your Time and Patience.

You may also be able to use your masks as they are, and set up your UVs as a UDIM arrangement.

You’d need to offset each key’s UV by multiple units in the X or Y, and name your existing mask images appropriately to map tp the correct key.

That way it’s a single UDIM image set, and everything can get the same material.