Simplified ConnecctionCable shader

This commit is contained in:
2026-06-20 15:06:16 +03:00
parent 6667047406
commit 0a8c9a8163
+4 -10
View File
@@ -5,19 +5,13 @@ uniform float glow_radius : hint_range(0.0, 1.0, 0.00001) = 1.0;
uniform float travel_time : hint_range(0.0, 100.0, 1) = 5.0;
float get_alpha(vec2 uv, float offset) {
float dist = fract(mod(TIME, travel_time)/travel_time + offset);
float left = uv.x - glow_radius;
float right = uv.x + glow_radius;
return step(left, dist) * (1.0 - step(right, dist));
float progress = fract(mod(TIME, travel_time)/travel_time + offset);
return step(distance(progress, uv.x), glow_radius);
}
void fragment() {
float alpha = 0.0;
float offset = 0.0;
COLOR.a = 0.0;
for (float offset = 0.0; offset <= 1.0; offset += glow_interval) {
alpha += get_alpha(UV, offset);
COLOR.a += get_alpha(UV, offset);
}
COLOR.a = alpha;
}