From 08bc48df3d3e6cdaaf39dcb60d6596d79adf6ba0 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Mon, 14 Apr 2025 12:12:21 -0400 Subject: [PATCH] GLSL smoothstep is NOT lerp, it's 'Hermite linear interpolation' which basically means not a damn thing anyone says it is. mix is what I want. --- assets/shaders/ui_shader.frag | 4 ++-- combat_ui.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/shaders/ui_shader.frag b/assets/shaders/ui_shader.frag index d599f7c..d60b826 100644 --- a/assets/shaders/ui_shader.frag +++ b/assets/shaders/ui_shader.frag @@ -9,13 +9,13 @@ uniform bool is_shape; void main() { if(is_shape) { float tick = (u_time_end - u_time) / u_duration; - float blink = smoothstep(1.0, 0.5, tick); + float blink = mix(0.5, 1.0, tick); vec4 color = vec4(blink, blink, blink, 1.0); gl_FragColor = gl_Color * color; } else { vec4 pixel = texture2D(texture, gl_TexCoord[0].xy); float tick = (u_time_end - u_time) / u_duration; - float blink = smoothstep(1.0, 0.5, tick); + float blink = mix(0.5, 1.0, tick); vec4 color = vec4(blink, blink, blink, 1.0); gl_FragColor = gl_Color * color * pixel; } diff --git a/combat_ui.cpp b/combat_ui.cpp index 0be735e..75f4dfa 100644 --- a/combat_ui.cpp +++ b/combat_ui.cpp @@ -18,7 +18,7 @@ namespace gui { $gui.set(button, {"leather_pouch-128"}); // $gui.set(button, {}); $gui.set