fix: liquid fills from bottom; make module root panel transparent with 12px corners to eliminate grey corners

This commit is contained in:
Eric Smith 2026-05-20 15:07:42 -04:00
parent 3eb089b776
commit 308cf26a77
3 changed files with 27 additions and 6 deletions

View file

@ -36,20 +36,21 @@ void fragment() {
float inner_d = rr_sdf(uv_centered, vec2(inner_hw, inner_hh), inner_r);
float inner = 1.0 - smoothstep(0.0, max(0.001, fwidth(inner_d)), max(inner_d, 0.0));
// Liquid fill with a gentle animated wave at the surface
// Liquid fill with a gentle animated wave at the surface.
// UV.y = 0 is top, UV.y = 1 is bottom. fill = 0 → empty, fill = 1 → full.
float wave = sin(UV.x * wave_freq * 6.283 + TIME * 1.5) * wave_amp;
float fill_line = fill + wave;
float liquid = 1.0 - smoothstep(fill_line - 0.001, fill_line + 0.001, UV.y);
float fill_line = 1.0 - fill + wave;
float liquid = smoothstep(fill_line - 0.001, fill_line + 0.001, UV.y);
liquid *= inner;
// Base background
vec3 col = bg_color.rgb;
// Liquid with subtle depth gradient (lighter near the top)
vec3 liq = mix(liquid_color.rgb, liquid_color.rgb * 1.35, 1.0 - UV.y * 0.6);
// Liquid with subtle depth gradient
vec3 liq = mix(liquid_color.rgb, liquid_color.rgb * 1.35, 1.0 - UV.y);
col = mix(col, liq, liquid);
// Surface highlight line
// Surface highlight line at the top of the liquid column
float surface = smoothstep(fill_line - 0.008, fill_line, UV.y) - smoothstep(fill_line, fill_line + 0.002, UV.y);
col += surface * vec3(0.3, 0.4, 0.5) * liquid;