add motion vectors to all shaders
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / viewchar.fs
index 92e11bed3ae2cfa943a08118b1dab41fe2625b3b..f7e0370a06aeaa2c73a93d63198d166cef711968 100644 (file)
@@ -1,5 +1,3 @@
-out vec4 FragColor;
-
 uniform sampler2D uTexMain;
 uniform vec3 uCamera;
 
@@ -10,9 +8,12 @@ in vec3 aCo;
 in vec3 aWorldCo;
 
 #include "common_world.glsl"
+#include "motion_vectors_fs.glsl"
 
 void main()
 {
+   compute_motion_vectors();
+
    vec3 vfrag = texture( uTexMain, aUv ).rgb;
 
    // Lighting
@@ -20,12 +21,13 @@ void main()
    float fdist = length( halfview );
    halfview /= fdist;
 
-   vfrag = do_light_diffuse( vfrag, aNorm );
-   vfrag = do_light_spec( vfrag, aNorm, halfview, 0.1 );
+   vec3 qnorm = normalize(floor(aNorm*2.0)*0.5) + vec3(0.001,0.0,0.0);
+
+   vfrag = mix( vfrag, do_light_diffuse( vfrag, qnorm ), 0.5 );
+   //vfrag = do_light_spec( vfrag, qnorm, halfview, 0.1 );
    vfrag = do_light_shadowing( vfrag );
    vfrag = apply_fog( vfrag, fdist );
 
-   float opacity = clamp( fdist, 0.1, 1.0 );
-
-   FragColor = vec4(vfrag,opacity);
+   float opacity = clamp( fdist*fdist, 0.1, 1.0 );
+   oColour = vec4(vfrag,opacity);
 }