shader_type spatial; render_mode blend_add, unshaded, cull_disabled, depth_draw_never, fog_disabled; // UV.y = 0 at the socket, 1 at the tip. UV.x = 0..1 across the ribbon. uniform vec4 root_color : source_color = vec4(1.0, 1.0, 1.0, 0.95); uniform vec4 mid_color : source_color = vec4(0.47, 0.71, 1.0, 0.35); uniform vec4 tip_color : source_color = vec4(0.16, 0.31, 1.0, 0.0); uniform float opacity : hint_range(0.0, 2.0, 0.001) = 0.0; void fragment() { float v = UV.y; float edge = abs(UV.x - 0.5) * 2.0; float side = 1.0 - smoothstep(0.36, 1.0, edge); vec3 col = mix(root_color.rgb, mid_color.rgb, smoothstep(0.0, 0.45, v)); col = mix(col, tip_color.rgb, smoothstep(0.35, 1.0, v)); float a = mix(root_color.a, mid_color.a, smoothstep(0.05, 0.45, v)); a = mix(a, tip_color.a, smoothstep(0.45, 1.0, v)); ALBEDO = col; ALPHA = clamp(a * side * opacity, 0.0, 1.0); }