df shadows
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / standard.fs
1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexMain;
3 uniform vec3 uCamera;
4 uniform vec4 uPlane;
5 uniform vec3 uBoard0;
6 uniform vec3 uBoard1;
7
8 in vec4 aColour;
9 in vec2 aUv;
10 in vec3 aNorm;
11 in vec3 aCo;
12 in vec3 aWorldCo;
13
14 #include "common_world.glsl"
15 #include "motion_vectors_fs.glsl"
16
17 void main()
18 {
19 compute_motion_vectors();
20
21 vec3 vfrag = vec3(0.5,0.5,0.5);
22 vec4 vsamplemain = texture( uTexMain, aUv );
23 vec3 qnorm = normalize(aNorm);
24
25 vfrag = vsamplemain.rgb;
26
27 if( g_light_preview == 1 )
28 {
29 vfrag = vec3(0.5);
30 }
31
32 // Lighting
33 vec3 halfview = uCamera - aWorldCo;
34 float fdist = length( halfview );
35 halfview /= fdist;
36
37 vfrag = do_light_diffuse( vfrag, qnorm );
38 vfrag = do_light_spec( vfrag, qnorm, halfview, 0.1 );
39 vfrag = do_light_shadowing( vfrag );
40 vfrag = apply_fog( vfrag, fdist );
41
42 oColour = vec4(vfrag, 1.0);
43 }