How can I fill a shaped HUD (health/mana) bar with scalar quantity?

Ok, so for our hud, we’ve got a pair of crescent shapes for health and energy. I’ve been trying to follow the example in the content pack, but so far, it hasn’t translated, completely, to my use case. I get a “play in editor” error of “Error Accessed None ‘Character object’ from node Set energyBar in blueprint HUD2”

my workflow looks like this: photo HUDBP_zps4dd6e1a0.jpg

It means the character object you are trying to refer to is invalid as it is currently and empty reference. You may need to cast to the player.

Sorry for the confusion. While I mentioned the error message, it was more of an aside than the actual problem. What I need to do is dynamically fill the crescent shapes, with a material. I finally overcame one obstacle (actually getting a material to be dynamic so it could be used) However, i’m still just generating a straight, rectangular bar (although, as has been pointed out due to the error with the character, empty)

you should be able to make crescent shaped health bars in a material instance using a gray scale gradient texture that follows the direction of the health bar. you take the gradient texture, raise it to a power, multiply it by a coefficient, and clamp it between 0 and 1. use this to lerp between your background and foreground color. i haven’t tried this in UE4, but that was the way it worked in UDK.

Thanks, I’ll pass this onto the artists on the team. Hopefully they understand all those words :stuck_out_tongue:

tell them its like thresholding in photoshop. its all about taking a gradient and choosing a cutoff value. everything brighter becomes white, everything darker becomes black. by adjusting your cutoff value, you can adjust where the edge of the guage is. the biggest problem with this method is the fuzzy edges it can cause. (see image)

there are other methods, like creating triangle strips in a vertex shader (more complicated but better results) or just using frame animation, which takes up more memory, but gives you alot of control. or you can use 2 white rectangles hidden behind a black rectangle rotated around a point, then half way around circle one of the white rectangles stops while the other continues the full rotation, filling the circle and producing a perfectly straight edge. this method is my favorite, but its even more difficult to explain than the other methods, and it only works for circles, so you can’t use sword shapes or follow winding paths. if you wanted something like a dynamite fuse for a health bar, with a wavy rope shape, the gradient method or frame animation is the best way, but if you want a perfect circle pie graph, than one of the other methods might be better.

here is what i meant with the first method that can cause fuzzy edges:

7683-circleguage.gif

I don’t know if I really understood what you need, have you thought about multiplying your energy value by a number and plug it in your draw material’s width? That would increase and decrease the lenght of your health bar

Ok, sorry for not coming back to this for so long, but I got moved to something else for a bit. I’ve got a mask set up now that gives me a half circle, however I need it to fill vertically, instead of horizontally. anyone have an idea? I don’t see any options on the scalar fill that would get me there.