Creating a segmented healthbar

It’s pretty late, though I had the same problem and figured out this elegant solution all done within the material. Wanted to share with anyone else looking.

Create a Custom Node, type in the following code, and plug in a texture with just a line down the left side, this is the “Segment line”. The code will literally paste the texture evenly across, keeping it perfect without any sort of stretching. Manipulate in any way needed.

With a few changes to the code, this can be used for many other things that could do with repeated textures. Below is an example of multiple items that stay centered. It also has additional code to blend the alphas properly.

Goodluck!