accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_sky.fs
1 uniform sampler2D uTexGarbage;
2
3 in vec4 aColour;
4 in vec2 aUv;
5 in vec3 aNorm;
6 in vec3 aCo;
7 in vec3 aWorldCo;
8
9 // Spooky!
10 const vec3 uCamera = vec3(0.0);
11
12 #include "light_clearskies_stddef.glsl"
13 #include "common_world.glsl"
14 #include "motion_vectors_fs.glsl"
15
16 void main()
17 {
18 compute_motion_vectors();
19
20 vec3 rd = normalize(aNorm);
21
22 float fmove = g_time * 5.0;
23 vec2 cloudplane = (rd.xz / (rd.y*sign(rd.y))) * 0.025;
24 vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 );
25 vec4 clouds2 = texture( uTexGarbage, cloudplane*2.0 + vec2(0.3,0.1)*fmove );
26
27 float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0);
28 float cloud_e = pow(cloud_d,1.5)*pow(abs(rd.y),0.3)*2.0;
29
30 oColour = vec4( clearskies_sky( -rd ) ,1.0);
31
32 vec3 cloud_colour = mix( mix(g_nightsky_colour.rgb,vec3(1.0),g_day_phase),
33 g_sunset_colour.rgb, g_sunset_phase );
34
35 oColour.rgb = mix( oColour.rgb, cloud_colour, cloud_e );
36 }