Adding visual effects to object / overlay materials

Hmm, still no commen (even in [forum][1])t. Maybe I didn’t quite correctly describe the task or chose a title?
For an example of one use of such a system: to display the remaining health of each enemy by filling its material with the color as shown in the picture (the less left, the larger the red zone)

345597-chrome-2021-08-04-16-06-52.png