stepping
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_route.fs
index a2eeb99c810b50a17ce93eabf0b6a53b8250a90e..93ed9b1380e3b5171e7111f9c3ed95cabc04ad6c 100644 (file)
@@ -8,6 +8,13 @@ uniform vec3 uBoard1;
 #include "common_scene.glsl"
 #include "motion_vectors_fs.glsl"
 
+float filtered_stripe( in float p, in float ddx, in float ddy )
+{
+   float w = max(abs(ddx), abs(ddy)) + 0.02;
+   float i = (abs(fract((p-0.5*w)/2.0)-0.5)-abs(fract((p+0.5*w)/2.0)-0.5))/w;
+   return 0.5 - i;
+}
+
 void main()
 {
    compute_motion_vectors();
@@ -32,16 +39,19 @@ void main()
    vfrag = pow(uColour.rgb,vec3(1.0/2.2));
    vfrag -= rgarbage.a*0.1;
 
-   if( wgarbage.g < 0.3 )
+   if( wgarbage.g < 0.1 )
       discard;
 
+   float movep = (aUv.x + abs(aUv.y-0.5)*0.4 - g_realtime)*2.0;
+   float stripe = filtered_stripe( movep, dFdx(movep), dFdy(movep) );
+   vfrag *= 0.9+stripe*uColour.a; 
+
    if( g_light_preview == 1 )
    {
       vfrag = vec3(0.5);
    }
 
    // Lighting
-
-   vfrag = scene_do_lighting( vfrag, qnorm );
+   vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
    oColour = vec4(vfrag, 1.0);
 }