--- /dev/null
+uniform sampler2D uTexGarbage;
+uniform sampler2D uTexGradients;
+uniform vec3 uCamera;
+uniform vec4 uColour;
+uniform vec3 uBoard0;
+uniform vec3 uBoard1;
+
+in vec2 aUv;
+in vec4 aNorm;
+in vec3 aCo;
+in vec3 aWorldCo;
+flat in ivec4 aLights;
+
+#include "common_scene.glsl"
+#include "motion_vectors_fs.glsl"
+
+void main()
+{
+ compute_motion_vectors();
+
+ vec3 vfrag = vec3(0.5,0.5,0.5);
+
+ // ws modulation
+ vec4 wgarbage = texture( uTexGarbage, aCo.xz * 0.015 );
+
+ // Creating normal patches
+ vec3 modnorm = (wgarbage.rgb-0.4) * 1.4;
+ vec3 qnorm = normalize(floor(aNorm.xyz*4.0+modnorm)*0.25);
+ qnorm += vec3(0.001,0.0,0.0);
+
+ vec3 tangent0 = normalize(cross(qnorm,vec3(0.0,1.0,0.0)));
+ vec3 tangent1 = cross(qnorm,tangent0);
+ vec2 uvdiffuse = vec2( dot(tangent0,aCo), dot(tangent1,aCo) ) * 0.035;
+
+ // Patch local noise
+ vec4 rgarbage = texture( uTexGarbage, uvdiffuse );
+
+ vfrag = pow(uColour.rgb,vec3(1.0/2.2));
+ vfrag -= rgarbage.a*0.1;
+
+ if( wgarbage.g < 0.3 )
+ discard;
+
+ if( g_light_preview == 1 )
+ {
+ vfrag = vec3(0.5);
+ }
+
+ // Lighting
+
+ vfrag = scene_do_lighting( vfrag, qnorm );
+ oColour = vec4(vfrag, 1.0);
+}