Change color in material with many textures

So I have a texture with 14 buttons on it and I need it so if I click button 1 it will turn green, so I have one texture for each button(everyone of these textures are in one material connected to alot of lerps). As you can see in the picture(Blueprint part) level 1 event was just for troubleshooting and level 2 event

was my original idea

Hi there,

Let’s simplify, and move most everything into the shader!

On the far left of the material window, you can see two variables. Column and row. It should be pretty self explanatory, but you simply put in a 0 in column to keep it in the left column, and then pick a row by number. In this image, you can see I have column zero, row 1 (this is 0 based, you could always fix it to start at 1). There is also a parameter for brightness, and color as well. This should help you simplify things greatly!

Here is the texture I used. Notice I put the “glow mask” in the red channel, and kept the circles themselves in the green channel. This saves us texture memory by packing the information into one texture.

I hope this helps!

Thank you for the answer!
But i have a questions,as you can see in the picture below i have replicated what you did(just saying I am very new to Unreal) and I did not get the same result

oh no the texture is square just that i put it there to show you my texture, it is 2048x2048

Yeah! thank you so much! and I would presume that the texcoord on the far left should be U:.25 and V:1…right?

Ofcourse Thank you!

Judging by the texture on the right, you’ve cut the texture down from being square. This is likely why. It is (generally) good practice to make sure textures are square. You can make it work this way with some changes, however the shader wasn’t designed for that. You can use the texture I made if you’d like. You’ll also need to be sure you adjust your texcoordinate on the top texture to .25, 1. Since we were only using a quarter of the width of the texture I attached. You could absolutely use the rest of the black area for other textures in your elevator buttons, and should do so!

Hope that helps

Thanks

Ah ok :slight_smile: In any case, make sure you set the top textures UV to .25 on U, and 1 on V. That should fix ya up! Also, 2048 is probably overkill for how big this thing will be on the screen, unless of course, again, you use up the black space that isn’t currently being used!

No, it should just stay as 1 and 1, because it has other math adjusting it, based on the parameter values you are changing. Does that make sense? If you need an explanation, lemme know.

Also, when this is working for you, you should mark this as answered :wink:

My pleasure! Enjoy your day.

Have another problem here(hopefully it is not annoying that I ask so much) as you can see here…

Yeah I was affraid of that… anyways Thanks for you time!

I don’t have your files and didn’t know your exact setup, so if you were to change it over to something more like I wrote up for you, you’ll likely have to change things to make it work.

If I were you, I’d just unwrap the object you have to make it work with what I’ve shown you. It’ll make things lots easier on you, I’d bet. Best of luck!