blob: 1633a2e5930630f35e22826b1e00fd811cc6a35f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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);
}
|