From 52ca136fa387f3b838cabf540f957ef916997d2b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 21 Jun 2021 18:38:25 +0200 Subject: clamp shaders --- shaders/rounded_rectangle_no_shadow.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shaders/rounded_rectangle_no_shadow.glsl') diff --git a/shaders/rounded_rectangle_no_shadow.glsl b/shaders/rounded_rectangle_no_shadow.glsl index 4fc32cf..e5915da 100644 --- a/shaders/rounded_rectangle_no_shadow.glsl +++ b/shaders/rounded_rectangle_no_shadow.glsl @@ -15,7 +15,7 @@ void main() { vec2 size = (resolution - shadow_offset * 2.0) * 0.5; float rect_dist = rounded_rect(uv - center, size, radius); - float a = 1.0 - smoothstep(0.0, 2.0, rect_dist); + float a = clamp(1.0 - smoothstep(0.0, 2.0, rect_dist), 0.0, 1.0); // same as: if(uv.x >= band_pos.x && uv.x <= band_pos.x + band_size.x && uv.y >= band_pos.y && uv.y <= band_pos.y + band_size.y) vec2 band_blend = step(band_pos, uv) - step(band_pos + band_size, uv); vec4 front_color = mix(gl_Color, band_color, band_blend.x*band_blend.y); -- cgit v1.2.3