X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fsky.h;h=0abd65a1b12b5291217b3d5db3188ac4cc073e6d;hb=d045af680c6b8ca267a7aded69e2e510e659d2ab;hp=920036a0110f0ecb9be9dd11b4e78e23a5a7a967;hpb=afa80c76d03f5e983092e9d7be33a9102a7ab25e;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/sky.h b/shaders/sky.h index 920036a..0abd65a 100644 --- a/shaders/sky.h +++ b/shaders/sky.h @@ -7,12 +7,14 @@ static struct vg_shader _shader_sky = { .link = shader_sky_link, .vs = { -.orig_file = "../shaders/standard.vs", +.orig_file = "../../shaders/standard.vs", .static_src = "layout (location=0) in vec3 a_co;\n" "layout (location=1) in vec3 a_norm;\n" -"layout (location=2) in vec4 a_colour;\n" -"layout (location=3) in vec2 a_uv;\n" +"layout (location=2) in vec2 a_uv;\n" +"layout (location=3) in vec4 a_colour;\n" +"layout (location=4) in vec4 a_weights;\n" +"layout (location=5) in ivec4 a_groups;\n" "\n" "#line 2 0 \n" "\n" @@ -23,19 +25,22 @@ static struct vg_shader _shader_sky = { "out vec2 aUv;\n" "out vec3 aNorm;\n" "out vec3 aCo;\n" +"out vec3 aWorldCo;\n" "\n" "void main()\n" "{\n" -" gl_Position = uPv * vec4( uMdl * vec4(a_co,1.0), 1.0 );\n" +" vec3 world_pos = uMdl * vec4(a_co,1.0);\n" +" gl_Position = uPv * vec4( world_pos, 1.0 );\n" " aColour = a_colour;\n" " aUv = a_uv;\n" " aNorm = mat3(uMdl) * a_norm;\n" " aCo = a_co;\n" +" aWorldCo = world_pos;\n" "}\n" ""}, .fs = { -.orig_file = "../shaders/sky.fs", +.orig_file = "../../shaders/sky.fs", .static_src = "out vec4 FragColor;\n" "\n" @@ -51,27 +56,24 @@ static struct vg_shader _shader_sky = { "void main()\n" "{\n" " float fintensity = 1.0-(abs(aNorm.y)*0.7);\n" -" float angle = -dot(vec3(0.95,0.0,-0.3),aNorm)*0.5+0.5;\n" -" float fblend = pow(fintensity,6.0) * angle;\n" -" vec3 horizon = vec3(0.9,0.9,0.8);\n" -" vec3 skycolour = vec3(0.4,0.5,0.8);\n" +" float fblend = pow(fintensity,4.0);\n" +" vec3 horizon = vec3( 0.8, 0.9, 0.9 );\n" +" vec3 skycolour = vec3( 0.5, 0.6, 0.9 );\n" " vec3 diffuse = mix( skycolour, horizon, fblend );\n" "\n" -" float fmove = uTime * 0.001;\n" -" vec2 cloudplane = (aCo.xz / (aCo.y*sign(aNorm.y))) * 0.03;\n" +" float fmove = uTime * 0.004;\n" +" vec2 cloudplane = (aNorm.xz / (aNorm.y*sign(aNorm.y))) * 0.05;\n" " vec4 clouds1 = texture( uTexGarbage, cloudplane + vec2(0.1,0.4)*fmove*2.0 );\n" " vec4 clouds2 = texture( uTexGarbage, cloudplane + vec2(0.3,0.1)*fmove );\n" "\n" " float cloud_d = max(clouds1.b*clouds2.r -0.2 - clouds2.g*0.4,0.0);\n" -" float cloud_e = pow(cloud_d,1.8)*pow(abs(aNorm.y),0.3)*2.0;\n" +" float cloud_e = pow(cloud_d,1.5)*pow(abs(aNorm.y),0.3)*2.0;\n" "\n" " vec3 colour_ocean = vec3( 0.61, 0.84, 0.9 );\n" " float fhorizon = step( aNorm.y * 0.5 + 0.5, 0.5 );\n" "\n" -" vec3 skycomp = mix(diffuse, vec3(1.0), cloud_e);\n" -" skycomp = mix(mix(pow(colour_ocean,vec3(6.0))*0.6,skycomp, 0.7),skycomp,fhorizon);\n" -"\n" -" FragColor = vec4(skycomp, 1.0);\n" +" vec3 skycomp = mix(diffuse, vec3(1.0,1.0,1.0), cloud_e);\n" +" FragColor = vec4(pow(skycomp, vec3(1.5)),1.0);\n" "}\n" ""}, };