fixes some artifacting
authorhgn <hgodden00@gmail.com>
Fri, 2 Dec 2022 17:41:10 +0000 (17:41 +0000)
committerhgn <hgodden00@gmail.com>
Fri, 2 Dec 2022 17:41:10 +0000 (17:41 +0000)
15 files changed:
shaders/alphatest.h
shaders/gpos.h
shaders/menu.h
shaders/motion_vectors_common.glsl [new file with mode: 0644]
shaders/motion_vectors_fs.glsl
shaders/motion_vectors_vs.glsl
shaders/route.h
shaders/scoretext.h
shaders/sky.h
shaders/standard.h
shaders/terrain.h
shaders/vblend.h
shaders/viewchar.h
shaders/water.h
shaders/water_fast.h

index d5c38d0a7755fc2d8f2e82d0fa091e4261e91c95..8b06893f0b88a6fefae287b57e22af32c36d26cc 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_alphatest = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -176,6 +182,10 @@ static struct vg_shader _shader_alphatest = {
 "\n"
 "#line     13        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -186,7 +196,8 @@ static struct vg_shader _shader_alphatest = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     14        0 \n"
index b60fb758deddf2bd360f05e5c9964ba0b6a1d39b..a41a7f7c56d76155c81f8722de59c697842a1737 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_gpos = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
index 2a14ac1921673ce3a5e09f48d2a644b44961eb5d..a0baa701ad00b221093b503b3671710f10885e3a 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_menu = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
diff --git a/shaders/motion_vectors_common.glsl b/shaders/motion_vectors_common.glsl
new file mode 100644 (file)
index 0000000..1d6ed97
--- /dev/null
@@ -0,0 +1 @@
+const float k_motion_lerp_amount = 0.05;
index e6d2759fc0df013159701b1f8c82d84a450f8ec6..315416bdd49d68d838e41c89835aec15ff91ee13 100644 (file)
@@ -1,3 +1,5 @@
+#include "motion_vectors_common.glsl"
+
 layout (location = 1) out vec2 oMotionVec;
 
 in vec3 aMotionVec0;
@@ -8,5 +10,6 @@ void compute_motion_vectors()
    // Write motion vectors
    vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;
    vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;
-   oMotionVec = vmotion1-vmotion0;
+
+   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);
 }
index 25c176d614263dc6dd8a824e3ba50f5afda00f54..63a17dbdb8f06b22f39e676347292168912a107a 100644 (file)
@@ -1,8 +1,12 @@
+#include "motion_vectors_common.glsl"
+
 out vec3 aMotionVec0;
 out vec3 aMotionVec1;
 
 void vs_motion_out( vec4 vproj0, vec4 vproj1 )
 {
+   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;
+
    aMotionVec0 = vec3( vproj0.xy, vproj0.w );
    aMotionVec1 = vec3( vproj1.xy, vproj1.w );
 }
index 521df235f1eb63c9f3cfeeb5a2fd7251bc05c8c3..b003858c513f284ee2ec4f9f1544319516045e79 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_route = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -176,6 +182,10 @@ static struct vg_shader _shader_route = {
 "\n"
 "#line     13        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -186,7 +196,8 @@ static struct vg_shader _shader_route = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     14        0 \n"
index 55734a37e1d36e3def197291dd00aa0d75975363..06fa71996660b13081b1a1276ada26be4addd9c9 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_scoretext = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -197,6 +203,10 @@ static struct vg_shader _shader_scoretext = {
 "\n"
 "#line     12        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -207,7 +217,8 @@ static struct vg_shader _shader_scoretext = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     13        0 \n"
index fa0546f5bbb5bce4648615118de2ccb9760b75ac..931dec18490f47538d400d67ed870117e1eea94e 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_sky = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -69,6 +75,10 @@ static struct vg_shader _shader_sky = {
 "in vec3 aCo;\n"
 "\n"
 "#line       1        1 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -79,7 +89,8 @@ static struct vg_shader _shader_sky = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     13        0 \n"
index 3c759b6c8584a93decf24298faa23cd2577ba57a..319e6be91bf5a4f181d49ec9c1402a1beef5ad34 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_standard = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -176,6 +182,10 @@ static struct vg_shader _shader_standard = {
 "\n"
 "#line     13        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -186,7 +196,8 @@ static struct vg_shader _shader_standard = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     14        0 \n"
index 460ba9e5d02392e2ad3a2e94ffef59132a13a1d5..cf32d5ea5c5bc49bc2c103ca19e8154c2531474e 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_terrain = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -177,6 +183,10 @@ static struct vg_shader _shader_terrain = {
 "\n"
 "#line     14        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -187,7 +197,8 @@ static struct vg_shader _shader_terrain = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     15        0 \n"
index 2a5dacf8bcb16d9db7ede932a3e82b07143ca0b8..ad3f82b1236790ce119a231266379ce831b2d157 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_vblend = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -175,6 +181,10 @@ static struct vg_shader _shader_vblend = {
 "\n"
 "#line     12        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -185,7 +195,8 @@ static struct vg_shader _shader_vblend = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     13        0 \n"
index 20f33d38fbb8bb24e95b58c5c6f9802871270c0b..e8d6fe741c482c6ffc553e64cd4439bfabaf0587 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_viewchar = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -185,6 +191,10 @@ static struct vg_shader _shader_viewchar = {
 "\n"
 "#line     11        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -195,7 +205,8 @@ static struct vg_shader _shader_viewchar = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     12        0 \n"
index 109f29dd5b11af7e38650924563de1689cb5719b..710d5c1fe0546f6fe5cf503b51b4945b8f134ec8 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_water = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -183,6 +189,10 @@ static struct vg_shader _shader_water = {
 "\n"
 "#line     20        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -193,7 +203,8 @@ static struct vg_shader _shader_water = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     21        0 \n"
index 3da3db2a41d926b782ec57a83679fbdfe686b94b..756f308cb3c4d01b8d50ad8e5fb73e04570f6f9d 100644 (file)
@@ -17,11 +17,17 @@ static struct vg_shader _shader_water_fast = {
 "\n"
 "#line      2        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "out vec3 aMotionVec0;\n"
 "out vec3 aMotionVec1;\n"
 "\n"
 "void vs_motion_out( vec4 vproj0, vec4 vproj1 )\n"
 "{\n"
+"   vproj1 = vproj0*(1.0-k_motion_lerp_amount) + vproj1*k_motion_lerp_amount;\n"
+"\n"
 "   aMotionVec0 = vec3( vproj0.xy, vproj0.w );\n"
 "   aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n"
 "}\n"
@@ -180,6 +186,10 @@ static struct vg_shader _shader_water_fast = {
 "\n"
 "#line     17        0 \n"
 "#line       1        2 \n"
+"const float k_motion_lerp_amount = 0.05;\n"
+"\n"
+"#line      2        0 \n"
+"\n"
 "layout (location = 1) out vec2 oMotionVec;\n"
 "\n"
 "in vec3 aMotionVec0;\n"
@@ -190,7 +200,8 @@ static struct vg_shader _shader_water_fast = {
 "   // Write motion vectors\n"
 "   vec2 vmotion0 = aMotionVec0.xy / aMotionVec0.z;\n"
 "   vec2 vmotion1 = aMotionVec1.xy / aMotionVec1.z;\n"
-"   oMotionVec = vmotion1-vmotion0;\n"
+"\n"
+"   oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n"
 "}\n"
 "\n"
 "#line     18        0 \n"