material: draw black vertical stripes next to each other, dynamic

Hi!

Im a total newbie on how to really generate materials. I wondered if someone could teach me how to do the following thing:

The material(-background) should be transparent - but draw a black vertical stripe each “distance x” next to each other.

To further explain what I want to do: http://i.imgur.com/sfHribE.png?2

I have a hp bar (progress bar) in the widget. Id like to have for every 100 health a black stripe. I made a shady one to test in photoshop - but it doesnt work too great with tiling per numbers - I thought there has to be a great way to mathematically express that in a material but i have no clue about “painting” with materials.

All google results show me only how to mess around with other things. I hoped some mathematical material genius can bring me on the right track.

I also browsed the material expression reference and I was completely overwhelmed.

regards t

tex coord node with a component mask for one channel which will give you a gradient from 0-1.
multiply that with however many strips you want resulting in a gradient going from 0-10 or something. feed it through a frac to get all of those back into the 0,1 range.
multiply by 0,5 and put it through a sine.
now you should be 90% finished ^^. subtract by some value in the 0-1 range and feed it through a ceil. done-ish ^^

2 Likes