How would I gradually redden a sprite based on health?
A variable can be declared as uniform. In this case, its value will come from outside the shader (it will be the responsibility of the material or whatever using the shader to provide it).
Functions can’t access uniforms or other shader variables.
Given that I want to have an enemy with health, and as the health percentage gets lower the enemy changes color to a more red version. I understand how to set a color in a shader, but how is it supposed to work if functions can't access variables!
Any examples or links would be great!
1) Enemy flashes red when hit and color turns back to main color.
2) Enemy color darkens the more damage taken.