X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fmodel_sky.fs;h=d6f28187cf400eb1e0c31447326d08d6288d000d;hb=38514b4ba03412ad51df02dc2ba345e1be41005d;hp=e89379944e0c4135285ce8e2c2e1345516e0560f;hpb=409edea2cf6271956137918e4e0b4f1c2addf620;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/model_sky.fs b/shaders/model_sky.fs index e893799..d6f2818 100644 --- a/shaders/model_sky.fs +++ b/shaders/model_sky.fs @@ -1,5 +1,4 @@ uniform sampler2D uTexGarbage; -uniform float uTime; in vec4 aColour; in vec2 aUv; @@ -7,6 +6,10 @@ in vec3 aNorm; in vec3 aCo; in vec3 aWorldCo; +// Spooky! +const vec3 uCamera = vec3(0.0); + +#include "light_clearskies_stddef.glsl" #include "common_world.glsl" #include "motion_vectors_fs.glsl" @@ -16,31 +19,18 @@ void main() vec3 rd = normalize(aNorm); - float fintensity = 1.0-(abs(rd.y)*0.7); - float fblend = pow(fintensity,4.0); - vec3 horizon = vec3( 0.87, 0.93, 0.98 ); - vec3 skycolour = vec3( 0.16, 0.58, 0.95 ) - rd.y*rd.y*0.5; - vec3 diffuse = mix( skycolour, horizon, fblend ); - - float fmove = uTime * 0.004; - vec2 cloudplane = (rd.xz / (rd.y*sign(rd.y))) * 0.05; + float fmove = g_time * 5.0; + vec2 cloudplane = (rd.xz / (rd.y*sign(rd.y))) * 0.025; vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 ); vec4 clouds2 = texture( uTexGarbage, cloudplane*2.0 + vec2(0.3,0.1)*fmove ); float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0); float cloud_e = pow(cloud_d,1.5)*pow(abs(rd.y),0.3)*2.0; - vec3 colour_ocean = vec3( 0.61, 0.84, 0.9 ); - float fhorizon = step( rd.y * 0.5 + 0.5, 0.5 ); - - vec3 skycomp = mix(diffuse, vec3(1.0,1.0,1.0), cloud_e); - + oColour = vec4( clearskies_sky( -rd ) ,1.0); - float sundot = clamp(dot(rd, -g_light_directions[0].xyz), 0.0, 1.0); - vec3 sun = 0.25 * vec3(1.0,0.7,0.4) * pow( sundot,5.0 ); - sun += 0.25 * vec3(1.0,0.8,0.6) * pow( sundot,64.0 ); - sun += 0.2 * vec3(1.0,0.8,0.6) * pow( sundot,512.0 ); - skycomp += sun * g_light_colours[0].rgb; + vec3 cloud_colour = mix( mix(g_nightsky_colour.rgb,vec3(1.0),g_day_phase), + g_sunset_colour.rgb, g_sunset_phase ); - oColour = vec4(skycomp,1.0); + oColour.rgb = mix( oColour.rgb, cloud_colour, cloud_e ); }