add motion vectors to all shaders
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / motion_vectors_fs.glsl
diff --git a/shaders/motion_vectors_fs.glsl b/shaders/motion_vectors_fs.glsl
new file mode 100644 (file)
index 0000000..e6d2759
--- /dev/null
@@ -0,0 +1,12 @@
+layout (location = 1) out vec2 oMotionVec;
+
+in vec3 aMotionVec0;
+in vec3 aMotionVec1;
+
+void compute_motion_vectors()
+{
+   // Write motion vectors
+   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;
+   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;
+   oMotionVec = vmotion1-vmotion0;
+}