now we're doing a bunch of them
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_character_view.fs
1 uniform sampler2D uTexMain;
2 uniform vec3 uCamera;
3
4 in vec4 aColour;
5 in vec2 aUv;
6 in vec3 aNorm;
7 in vec3 aCo;
8 in vec3 aWorldCo;
9
10 #include "common_world.glsl"
11 #include "motion_vectors_fs.glsl"
12
13 void main()
14 {
15 compute_motion_vectors();
16
17 vec3 vfrag = texture( uTexMain, aUv ).rgb;
18
19 // Lighting
20 vec3 halfview = uCamera - aWorldCo;
21 float fdist = length( halfview );
22 halfview /= fdist;
23 fdist -= 0.08;
24
25 vec3 qnorm = normalize(floor(aNorm*2.0)*0.5) + vec3(0.001,0.0,0.0);
26
27 vec3 total_light = newlight_compute_ambient();
28 vec3 world_light = newlight_compute_world_diffuse( qnorm );
29
30 float world_shadow = newlight_compute_sun_shadow();
31 total_light += world_light * world_shadow;
32
33 vfrag = apply_fog( vfrag * total_light, fdist );
34
35 float opacity = clamp( fdist*fdist, 0.0, 1.0 );
36 oColour = vec4(vfrag,opacity);
37 }