now we're doing a bunch of them
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_vertex_blend.fs
1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexGradients;
3 uniform vec3 uCamera;
4 uniform vec3 uBoard0;
5 uniform vec3 uBoard1;
6
7 #include "common_scene.glsl"
8 #include "motion_vectors_fs.glsl"
9
10 void main()
11 {
12 compute_motion_vectors();
13
14 vec3 vfrag = vec3(0.5,0.5,0.5);
15
16 // ws modulation
17 vec4 wgarbage = vec4(0.5,0.5,0.5,1.0);
18
19 // Creating normal patches
20 vec3 modnorm = (wgarbage.rgb-0.4) * 1.4;
21 vec3 qnorm = normalize(floor(aNorm.xyz*4.0+modnorm)*0.25);
22 qnorm += vec3(0.001,0.0,0.0);
23
24 vec3 tangent0 = normalize(cross(qnorm,vec3(0.0,1.0,0.0)));
25 vec3 tangent1 = cross(qnorm,tangent0);
26 vec2 uvdiffuse = vec2( dot(tangent0,aCo), dot(tangent1,aCo) ) * 0.160;
27
28 // Patch local noise
29 vec4 rgarbage = texture( uTexGarbage, uvdiffuse );
30
31 // Colour blending
32 float fblendclip = step(0.380,aNorm.w + (rgarbage.r-0.5)*-1.740)*0.320;
33 vec2 uvgradients = aUv + vec2( fblendclip, 0.0 );
34
35 vfrag = texture( uTexGradients, uvgradients ).rgb;
36 vfrag -= rgarbage.a*0.04;
37
38 if( g_light_preview == 1 )
39 {
40 vfrag = vec3(0.5);
41 }
42
43 vfrag = scene_do_lighting( vfrag, qnorm );
44 oColour = vec4(vfrag, 1.0);
45 }