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.

This commit is contained in:
Zed A. Shaw 2025-04-14 12:12:21 -04:00
parent 766b20f3f8
commit 08bc48df3d
2 changed files with 3 additions and 3 deletions

View file

@ -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;
}