bradley-mcfadden / worms

A game where you play as a sandworm fighting for survival in the modern world.
MIT License
0 stars 0 forks source link

Low health screen border #3

Open bradley-mcfadden opened 2 years ago

bradley-mcfadden commented 2 years ago

Rough implementation

uniform vec4 border: hint_color;
const float content: hint_range(0, 0.999) = 0.95;

void fragment() {
    vec2 uv_t = UV + vec2(-0.5);
    float r = length(uv_t);
    float rstep = step(r, content);
    vec4 tex = TEXTURE(UV);
    COLOR = mix(tex, border, (1 - r) * (1 / 1 - content) * rstep;
}