DonkeyKong64 grind crash
[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 "common_world.glsl"
13 #include "motion_vectors_fs.glsl"
14
15 void main()
16 {
17 compute_motion_vectors();
18
19 vec3 rd = normalize(aNorm);
20
21 float fmove = g_time * 5.0;
22 vec2 cloudplane = (rd.xz / (rd.y*sign(rd.y))) * 0.025;
23 vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 );
24 vec4 clouds2 = texture( uTexGarbage, cloudplane*2.0 + vec2(0.3,0.1)*fmove );
25
26 float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0);
27 float cloud_e = pow(cloud_d,1.5)*pow(abs(rd.y),0.3)*2.0;
28
29 oColour = vec4( clearskies_sky( -rd ) ,1.0);
30
31 vec3 cloud_colour = mix( mix(g_nightsky_colour.rgb,vec3(1.0),g_day_phase),
32 g_sunset_colour.rgb, g_sunset_phase );
33
34 oColour.rgb = mix( oColour.rgb, cloud_colour, cloud_e );
35 }