Download

Prevent opacity mask from swelling (double mask)?

I’m currently implementing a lot of radial progress bars for my HUD. These work quite well by using the VectorToRadial node and a scalar parameter (this is the same thing you see done in the UMG style docs for the jagged ring progress bar)

However, rather than filling the progress bar via a COLOR, I have to fill it via OPACITY. This is because the progress bar itself is actually two progress bars layered on top of one another (think like the Green Current HP / Red Recoverable HP you see in MvC as an example; one bar’s “start point” is dynamically set by the end of the other; my solution has been to first render ‘Bar 1 + Bar 2’ as the secondary bar, and then render ‘Bar 1’ by itself on top of that.)

This actually works pretty well; effectively, as the scalar parameter increases, the entire radial gradient is ratcheted upward closer to the Opacity cutoff point (meaning a further point ALONG the gradient makes it past the cutoff); by multiplying this by the mask in question, I can radially roll across the mask set for the meter, slowly revealing more or less of it as the scalar parameter changes.

Here’s the problem: the bar itself, being a circle, is dithered/smoothed. That’s just how image editing handles round surfaces drawn across square pixels. So, as I push the entire thing further up past the opacity cutoff limit, in addition to revealing more of the bar, the entire bar starts to swell outward. This, of course, happens because progressively more and more of that dithered round edge is making it past the mask cutoff.

So, what I think I need to do, is to sort of re-mask the entire thing, or make it translucent as well as masked. I need the masking to do that progressive reveal, but then I ALSO need to take the initial “full ring” texture’s alpha channel and use it to produce one final translucency layer so that all of the shapes drawn are properly smoothed along that rounded edge in a consistent fashion.

The problem is that one cannot, AFAIK, perform both a masking AND a translucency step in a material; it can only be rendered one way or the other.

Any ideas?