files-game/present/trail.gdshader
2026-10-01 23:01:56 -04:00

18 lines
771 B
Text

shader_type spatial;
render_mode blend_add, unshaded, cull_disabled, depth_draw_never, shadows_disabled;
// A speed-trail ghost (gameplay-plan.md §B6): a soft card-shaped glow a card leaves behind while it
// rushes, fading fast. Every ghost shares this material; the fade and color are per instance, so
// trails never duplicate materials.
uniform float energy = 0.9;
instance uniform vec4 tint : source_color = vec4(0.133, 0.827, 0.933, 1.0);
instance uniform float fade = 1.0;
void fragment() {
vec2 p = abs(UV - 0.5) * 2.0;
float edge = max(p.x, p.y);
// Bright at the rim, faint inside: an afterimage of the card's frame.
float a = (1.0 - smoothstep(0.82, 1.0, edge)) * (0.22 + 0.78 * smoothstep(0.55, 0.96, edge));
ALBEDO = tint.rgb * energy * a * fade;
}