out vec4 outcolor; in vec2 frag_texture_coord; uniform sampler2D current_frame; uniform sampler2D previous_frame; uniform float decay; void main() { vec3 current = texture(current_frame, frag_texture_coord).rgb; vec3 previous = texture(previous_frame, frag_texture_coord).rgb; // Mix current frame with decayed previous frame // Higher decay = more trail (0.5 = subtle, 0.7 = noticeable) vec3 result = max(current, previous * decay); outcolor = vec4(result, 1.0); }