X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fsky.h;h=b7b26ef487bf178941623af151b4796be2a203a4;hb=0124cd309a7db70cdd74b5661f2df8b862ca2f2f;hp=fa0546f5bbb5bce4648615118de2ccb9760b75ac;hpb=f7db507815e2822d971031c30f25e02b45e9c914;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/sky.h b/shaders/sky.h index fa0546f..b7b26ef 100644 --- a/shaders/sky.h +++ b/shaders/sky.h @@ -17,11 +17,19 @@ static struct vg_shader _shader_sky = { "\n" "#line 2 0 \n" "#line 1 2 \n" +"const float k_motion_lerp_amount = 0.01;\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" +" // This magically solves some artifacting errors!\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 +77,10 @@ static struct vg_shader _shader_sky = { "in vec3 aCo;\n" "\n" "#line 1 1 \n" +"const float k_motion_lerp_amount = 0.01;\n" +"\n" +"#line 2 0 \n" +"\n" "layout (location = 1) out vec2 oMotionVec;\n" "\n" "in vec3 aMotionVec0;\n" @@ -79,7 +91,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"