shader_type spatial; render_mode blend_mix, depth_prepass_alpha, cull_disabled, diffuse_burley; uniform bool circular_wash = false; uniform vec3 foam_color : source_color = vec3(0.83, 0.94, 0.93); void fragment() { vec2 p = UV * 2.0 - 1.0; float wash = sin(p.x * 18.0 + sin(p.y * 12.0 + TIME * 0.8) * 1.5); wash *= sin(p.y * 23.0 - TIME * 1.4 + p.x * 3.0); float mask = (1.0 - smoothstep(0.45, 1.0, abs(p.x))); mask *= 1.0 - smoothstep(0.2, 1.0, abs(p.y)); if (circular_wash) { float radius = length(p); float angle = atan(p.y, p.x); float broken_arcs = sin(radius * 32.0 - TIME * 0.75 + sin(angle * 5.0) * 0.6); mask = smoothstep(0.65, 0.94, broken_arcs); mask *= smoothstep(0.1, 0.35, radius) * (1.0 - smoothstep(0.65, 0.98, radius)); mask *= smoothstep(-0.3, 0.8, sin(angle * 3.0 + radius * 9.0)); } ALBEDO = foam_color; ROUGHNESS = 0.65; ALPHA = mask * smoothstep(-0.45, 0.6, wash) * 0.48; }