shader_type canvas_item; render_mode blend_mix; // 直接覆盖,不做额外混合 // 调节参数 uniform float intensity : hint_range(0.0, 2.0) = 1.0; // 效果强度 uniform float speed : hint_range(0.0, 10.0) = 1.0; // 动画速度 uniform int samples : hint_range(1, 8) = 4; // 采样层数 uniform float angle_spread : hint_range(0.0, 3.14) = 1.0; // 各通道最大偏移角度 uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap; void fragment() { // 屏幕 UV vec2 uv = SCREEN_UV; // 总颜色累加器 vec4 col = vec4(0.0); // 动态参数 float t = TIME * speed; // 多次采样叠加 for (int i = 0; i < samples; i++) { // 每层一个角度偏移 + 时间抖动 float a = float(i) * (2.0 * PI / float(samples)) + sin(t + float(i)) * angle_spread; // 偏移量向量,依据 intensity 控制幅度 vec2 offset = vec2(cos(a), sin(a)) * (0.005 * intensity); col += texture(SCREEN_TEXTURE, uv + offset); } // 平均并输出 col /= float(samples); COLOR = col; }