036f2445001ed8ccfddf0a2c9aee0cf165dda6da
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_sky.fs
1 layout (location = 0) out vec4 oColour;
2
3 uniform vec4 uColour;
4 uniform sampler2D uTexGarbage;
5 uniform float uTime;
6
7 in vec4 aColour;
8 in vec2 aUv;
9 in vec3 aNorm;
10 in vec3 aCo;
11
12 #include "motion_vectors_fs.glsl"
13
14 void main()
15 {
16 compute_motion_vectors();
17
18 float fintensity = 1.0-(abs(aNorm.y)*0.7);
19 float fblend = pow(fintensity,4.0);
20 vec3 horizon = vec3( 0.8, 0.9, 0.9 );
21 vec3 skycolour = vec3( 0.5, 0.6, 0.9 );
22 vec3 diffuse = mix( skycolour, horizon, fblend );
23
24 float fmove = uTime * 0.004;
25 vec2 cloudplane = (aNorm.xz / (aNorm.y*sign(aNorm.y))) * 0.05;
26 vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 );
27 vec4 clouds2 = texture( uTexGarbage, cloudplane + vec2(0.3,0.1)*fmove );
28
29 float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0);
30 float cloud_e = pow(cloud_d,1.5)*pow(abs(aNorm.y),0.3)*2.0;
31
32 vec3 colour_ocean = vec3( 0.61, 0.84, 0.9 );
33 float fhorizon = step( aNorm.y * 0.5 + 0.5, 0.5 );
34
35 vec3 skycomp = mix(diffuse, vec3(1.0,1.0,1.0), cloud_e);
36 oColour = vec4(pow(skycomp, vec3(1.5)),1.0);
37 }