actually render trails
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / trail.fs
diff --git a/shaders/trail.fs b/shaders/trail.fs
new file mode 100644 (file)
index 0000000..e6ba5a8
--- /dev/null
@@ -0,0 +1,18 @@
+layout (location = 0) out vec4 oColour;
+in float aAlpha;
+uniform vec4 uColour;
+
+#include "motion_vectors_fs.glsl"
+
+void main(){
+   compute_motion_vectors();
+
+   vec2 ssuv = gl_FragCoord.xy;
+   vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );
+   float dither = fract( vDither.g / 71.0 ) - 0.5;
+
+   if( aAlpha+dither<0.5 )
+      discard;
+
+   oColour = vec4( uColour.rgb, uColour.a * aAlpha );
+}