fix: sample noise at distorted uv for visible deformation effects

This commit is contained in:
Eric Smith 2026-05-20 21:41:37 -04:00
parent d636d0f847
commit 12b8fee0b0

View file

@ -112,11 +112,11 @@ void fragment() {
// swirl
uv = get_swirl_uv(uv, swirl_strength);
// sample the ColorRect texture (water image if assigned, else 1x1 white)
vec4 tex = texture(TEXTURE, uv);
// hue-shift the base liquid colour, modulated by the texture
vec3 base_rgb = tex.rgb * liquid_color.rgb;
// Sample the noise at the distorted UV for visible liquid variation.
// (ColorRect has no texture, so TEXTURE is always white — this makes
// wave/ripple/swirl deformation visible by sampling noise instead.)
float detail = texture(noise_tex, (uv * noise_module_size / 100.0 * noise_scale + t * 0.03) * 0.5).r;
vec3 base_rgb = liquid_color.rgb * (0.85 + 0.15 * detail);
vec3 hsv = rgb2hsv(base_rgb);
hsv.x = fract(hsv.x + t * 0.1 * hue_shift_speed);
hsv.y = clamp(hsv.y + 0.2 * noise_val, 0.0, 1.0);