Files
tekton/assets/shaders/ticket_blur_dissolve.gdshader
T

25 lines
1002 B
Plaintext

shader_type canvas_item;
#include "res://assets/shaders/rounded_border.gdshaderinc"
uniform float blur_amount : hint_range(0.0, 1.0) = 0.0;
uniform float blur_radius_px : hint_range(0.0, 32.0) = 14.0;
uniform vec2 rect_size = vec2(100.0, 108.0);
uniform vec4 corner_radius = vec4(35.0, 35.0, 12.0, 12.0); // top-right, bottom-right, top-left, bottom-left
uniform float border_width : hint_range(0.0, 50.0) = 3.0;
uniform vec4 border_color : source_color = vec4(0.06666667, 0.13333334, 0.1882353, 1.0);
void fragment() {
vec2 px = TEXTURE_PIXEL_SIZE * blur_radius_px * blur_amount;
vec4 sum = texture(TEXTURE, UV) * 2.0;
float total_weight = 2.0;
for (int i = 0; i < 8; i++) {
float angle = float(i) * 0.7853981634; // TAU / 8
vec2 offset = vec2(cos(angle), sin(angle)) * px;
sum += texture(TEXTURE, UV + offset);
total_weight += 1.0;
}
vec4 tex_color = (sum / total_weight) * COLOR;
COLOR = apply_rounded_border(tex_color, UV, rect_size, corner_radius, border_width, border_color);
}