1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexGradients;
11 flat in ivec4 aLights;
13 #include "common_scene.glsl"
14 #include "motion_vectors_fs.glsl"
18 compute_motion_vectors();
20 vec3 vfrag = vec3(0.5,0.5,0.5);
23 vec4 wgarbage = vec4(0.5,0.5,0.5,1.0);
25 // Creating normal patches
26 vec3 modnorm = (wgarbage.rgb-0.4) * 1.4;
27 vec3 qnorm = normalize(floor(aNorm.xyz*4.0+modnorm)*0.25);
28 qnorm += vec3(0.001,0.0,0.0);
30 vec3 tangent0 = normalize(cross(qnorm,vec3(0.0,1.0,0.0)));
31 vec3 tangent1 = cross(qnorm,tangent0);
32 vec2 uvdiffuse = vec2( dot(tangent0,aCo), dot(tangent1,aCo) ) * 0.160;
35 vec4 rgarbage = texture( uTexGarbage, uvdiffuse );
38 float fblendclip = step(0.380,aNorm.w + (rgarbage.r-0.5)*-1.740)*0.320;
39 vec2 uvgradients = aUv + vec2( fblendclip, 0.0 );
41 vfrag = texture( uTexGradients, uvgradients ).rgb;
42 vfrag -= rgarbage.a*0.04;
44 if( g_light_preview == 1 )
49 vfrag = scene_do_lighting( vfrag, qnorm );
50 oColour = vec4(vfrag, 1.0);