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