How to make shades of grey translucent?

Hey guys, I want to make a material which can be changed by a parameter which is the percentage of how many bars should be visible. Example: I use 0.2 (20%) and only the first two bars are visible. I think you have understood what I want to achieve. You can see a prototype of it down below, but it does not work as I want it to (0.2 shows 4 or 5 bars).
Please help me with that :confused:

Smart implementation. The issue is probably with the calibration of the grey bars texture. I’d make the texture green to avoid any confusion as you are only using that channel, then the first bar should be green = 0, the second bar should be green = 25 (to leave a gap of 0.5), the third should be green = 50, so on and so forth.

Btw, this will only work as a user interface because of the IF node - if you put this on anything that gets rendered the greys will change based on the angle and that will break your material.

Hope this helps,

I’ll try to edit it that way thanks ^^

It is the same result: