baby lock the door and turn the lights down low
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_route.fs
1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexGradients;
3 uniform vec3 uCamera;
4 uniform vec4 uColour;
5 uniform vec3 uBoard0;
6 uniform vec3 uBoard1;
7
8 #include "common_scene.glsl"
9 #include "motion_vectors_fs.glsl"
10
11 void main()
12 {
13 compute_motion_vectors();
14
15 vec3 vfrag = vec3(0.5,0.5,0.5);
16
17 // ws modulation
18 vec4 wgarbage = texture( uTexGarbage, aCo.xz * 0.015 );
19
20 // Creating normal patches
21 vec3 modnorm = (wgarbage.rgb-0.4) * 1.4;
22 vec3 qnorm = normalize(floor(aNorm.xyz*4.0+modnorm)*0.25);
23 qnorm += vec3(0.001,0.0,0.0);
24
25 vec3 tangent0 = normalize(cross(qnorm,vec3(0.0,1.0,0.0)));
26 vec3 tangent1 = cross(qnorm,tangent0);
27 vec2 uvdiffuse = vec2( dot(tangent0,aCo), dot(tangent1,aCo) ) * 0.035;
28
29 // Patch local noise
30 vec4 rgarbage = texture( uTexGarbage, uvdiffuse );
31
32 vfrag = pow(uColour.rgb,vec3(1.0/2.2));
33 vfrag -= rgarbage.a*0.1;
34
35 if( wgarbage.g < 0.3 )
36 discard;
37
38 if( g_light_preview == 1 )
39 {
40 vfrag = vec3(0.5);
41 }
42
43 // Lighting
44 vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
45 oColour = vec4(vfrag, 1.0);
46 }