cleanup unused files
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_sky_simple.fs
1 uniform sampler2D uTexGarbage;
2 uniform float uTime;
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 rd = normalize(aNorm);
18
19 float fintensity = 1.0-(abs(rd.y)*0.7);
20 float fblend = pow(fintensity,4.0);
21 vec3 horizon = vec3( 0.87, 0.93, 0.98 );
22 vec3 skycolour = vec3( 0.16, 0.58, 0.95 ) - rd.y*rd.y*0.5;
23 vec3 diffuse = mix( skycolour, horizon, fblend );
24
25 float fmove = uTime * 0.004;
26 vec2 cloudplane = (rd.xz / (rd.y*sign(rd.y))) * 0.05;
27 vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 );
28 vec4 clouds2 = texture( uTexGarbage, cloudplane*2.0 + vec2(0.3,0.1)*fmove );
29
30 float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0);
31 float cloud_e = pow(cloud_d,1.5)*pow(abs(rd.y),0.3)*2.0;
32
33 vec3 colour_ocean = vec3( 0.61, 0.84, 0.9 );
34 float fhorizon = step( rd.y * 0.5 + 0.5, 0.5 );
35
36 vec3 skycomp = mix(diffuse, vec3(1.0,1.0,1.0), cloud_e);
37
38
39 float sundot = clamp(dot(rd, -g_light_directions[0].xyz), 0.0, 1.0);
40 vec3 sun = 0.25 * vec3(1.0,0.7,0.4) * pow( sundot,5.0 );
41 sun += 0.25 * vec3(1.0,0.8,0.6) * pow( sundot,64.0 );
42 sun += 0.2 * vec3(1.0,0.8,0.6) * pow( sundot,512.0 );
43 skycomp += sun * g_light_colours[0].rgb;
44
45 oColour = vec4(skycomp,1.0);
46 }