From 08d97f20fffb31e83172104268eaafcaba25611b Mon Sep 17 00:00:00 2001 From: Xonk Date: Sun, 17 Dec 2023 22:25:26 -0500 Subject: [PATCH] DOUBLE LAYER CLOUDS TEST 5. ALOT OF END SHADER WORK DONE. fix a few tiny issues and some tweaks here and there. --- shaders/block.properties | 3 +- shaders/dimensions/all_translucent.fsh | 32 +++- shaders/dimensions/composite1.fsh | 76 +++++--- shaders/dimensions/composite2.fsh | 4 +- shaders/dimensions/composite3.fsh | 17 +- shaders/dimensions/composite5.fsh | 12 +- shaders/dimensions/deferred.fsh | 54 +++--- shaders/dimensions/deferred.vsh | 16 +- shaders/dimensions/deferred2.fsh | 2 +- shaders/dimensions/deferred2.vsh | 2 +- shaders/lang/en_us.lang | 8 +- shaders/lib/DailyWeatherSettings.glsl | 3 - shaders/lib/clouds.glsl | 16 -- shaders/lib/end_fog.glsl | 248 +++++++++++-------------- shaders/lib/fallback_fog.glsl | 54 ------ shaders/lib/settings.glsl | 6 +- shaders/lib/volumetricClouds.glsl | 71 ++++--- shaders/lib/waterBump.glsl | 2 +- shaders/shaders.properties | 12 +- 19 files changed, 299 insertions(+), 339 deletions(-) delete mode 100644 shaders/lib/DailyWeatherSettings.glsl delete mode 100644 shaders/lib/clouds.glsl delete mode 100644 shaders/lib/fallback_fog.glsl diff --git a/shaders/block.properties b/shaders/block.properties index 0a44528..a686b08 100644 --- a/shaders/block.properties +++ b/shaders/block.properties @@ -58,5 +58,4 @@ # workaround mixed render stages block.3000 = minecraft:redstone_wire - layer.translucent = minecraft:glass_pane minecraft:glass - # layer.cutout = minecraft:tripwire minecraft:slime_block minecraft:nether_portal minecraft:honey_block minecraft:ice minecraft:black_stained_glass minecraft:black_stained_glass_pane minecraft:blue_stained_glass minecraft:blue_stained_glass_pane minecraft:brown_stained_glass minecraft:brown_stained_glass_pane minecraft:cyan_stained_glass minecraft:cyan_stained_glass_pane minecraft:gray_stained_glass minecraft:gray_stained_glass_pane minecraft:green_stained_glass minecraft:green_stained_glass_pane minecraft:light_blue_stained_glass minecraft:light_blue_stained_glass_pane minecraft:light_gray_stained_glass minecraft:light_gray_stained_glass_pane minecraft:lime_stained_glass minecraft:lime_stained_glass_pane minecraft:magenta_stained_glass minecraft:magenta_stained_glass_pane minecraft:orange_stained_glass minecraft:orange_stained_glass_pane minecraft:pink_stained_glass minecraft:pink_stained_glass_pane minecraft:purple_stained_glass minecraft:purple_stained_glass_pane minecraft:red_stained_glass minecraft:red_stained_glass_pane minecraft:white_stained_glass minecraft:white_stained_glass_pane minecraft:yellow_stained_glass minecraft:yellow_stained_glass_pane minecraft:glass_pane minecraft:glass \ No newline at end of file + layer.translucent = minecraft:glass_pane minecraft:glass diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 814d189..d79d8dd 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -59,15 +59,11 @@ uniform float sunIntensity; uniform vec3 sunColor; uniform vec3 nsunColor; - - - #include "/lib/Shadow_Params.glsl" #include "/lib/color_transforms.glsl" #include "/lib/projections.glsl" #include "/lib/sky_gradient.glsl" #include "/lib/waterBump.glsl" -#include "/lib/clouds.glsl" #include "/lib/stars.glsl" #ifdef OVERWORLD_SHADER @@ -79,6 +75,10 @@ uniform vec3 nsunColor; uniform float nightVision; #endif +#ifdef END_SHADER + #include "/lib/end_fog.glsl" +#endif + #include "/lib/diffuse_lighting.glsl" float blueNoise(){ @@ -275,6 +275,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { + #define PHYSICSMOD_FRAGMENT #include "/lib/oceans.glsl" @@ -291,6 +292,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec2 tempOffset = offsets[framemod8]; vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0)); vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + //////////////////////////////// //////////////////////////////// ALBEDO @@ -336,6 +338,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) tangent.z, tangent2.z, normal.z); vec4 NormalTex = texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).rgba; + NormalTex.xy = NormalTex.xy*2.0-1.0; NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0) ; TangentNormal = NormalTex.xy*0.5+0.5; @@ -473,7 +476,22 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #endif #ifdef END_SHADER - vec3 AmbientLightColor = vec3(1.0); + float fresnelGlow = pow(clamp(1.5 + dot(WS_normal, normalize(feetPlayerPos))*0.5,0,2),2); + vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow; + + + float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0); + vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds); + + + float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + vec3 lightColors = LightSourceColors(vortexBounds, lightningflash); + + float NdotL = clamp(dot(WS_normal, normalize(-lightPos))*0.5+0.5,0.0,1.0); + NdotL *= NdotL; + + Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL; + #endif Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); @@ -500,7 +518,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05); float f0 = SpecularTex.g; - roughness = 0.0; + // roughness = 0.0; // f0 = 0.9; if (iswater > 0.0 && gl_FragData[0].a < 0.9999999){ @@ -577,7 +595,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #ifndef HAND gl_FragData[1] = vec4(Albedo, iswater); #endif - + gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0); } } \ No newline at end of file diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index 0370a92..a8f99ac 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -421,7 +421,7 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins vec3 rayDir = direction * (isSSS ? 1.5 : 3.0) * vec3(RENDER_SCALE,1.0); vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise; - if(isSSS)screenPos -= rayDir*0.9; + if(isSSS) screenPos -= rayDir*0.9; for (int i = 0; i < int(steps); i++) { @@ -444,12 +444,13 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins } #ifdef END_SHADER - float GetShading( vec3 WorldPos, vec3 LightPos, vec3 Normal){ + float GetShading(vec3 WorldPos, vec3 LightPos, vec3 Normal){ - float NdotL = clamp(dot(Normal, normalize(-LightPos)),0.0,1.0); + float NdotL = clamp(dot(Normal, normalize(-LightPos))*0.5+0.5,0.0,1.0); + NdotL *= NdotL; float FogShadow = GetCloudShadow(WorldPos, LightPos); - return EndLightMie(LightPos) * NdotL * FogShadow; + return endFogPhase(LightPos) * NdotL * FogShadow; } #endif @@ -503,7 +504,36 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ #include "/lib/indirect_lighting_effects.glsl" #include "/lib/PhotonGTAO.glsl" +vec4 renderInfiniteWaterPlane( + vec3 FragPosition, inout vec3 oceanNormals +){ + float planeHeight = 20 + 0.50; + float total_extinction = 1.0; + vec3 color = vec3(0.0); + + //project pixel position into projected shadowmap space + vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) ); + vec3 dV_view = normalize(viewPos.xyz); dV_view *= 1.0/abs(dV_view.y); + + float mult = length(dV_view); + + float startFlip = mix(max(cameraPosition.y - planeHeight,0.0), max(planeHeight - cameraPosition.y,0), clamp(dV_view.y,0,1)); + float signFlip = mix(-1.0, 1.0, clamp(cameraPosition.y - planeHeight,0.0,1.0)); + if(max(signFlip * normalize(dV_view).y,0.0) > 0.0) return vec4(0,0,0,1); + + vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip; + + oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1)); + + vec3 Lighting = vec3(1); + float object = 1; + + color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction; + total_extinction *= max(exp(-mult*object),0.0); + + return vec4(color, total_extinction); +} void main() { @@ -543,6 +573,7 @@ void main() { lightmap.y = 1.0; #endif + ////// --------------- UNPACK MISC --------------- ////// vec4 SpecularTex = texture2D(colortex8,texcoord); @@ -617,9 +648,11 @@ void main() { #ifdef OVERWORLD_SHADER vec3 Background = vec3(0.0); - vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2; - Background += stars(orbitstar) * 10.0; - + + #if RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0 + vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2; + Background += stars(orbitstar) * 10.0; + #endif #if RESOURCEPACK_SKY == 2 Background += toLinear(texture2D(colortex10, texcoord).rgb * (255.0 * 2.0)); @@ -633,7 +666,7 @@ void main() { #endif #endif - Background *= exp(-25.0 * pow(clamp(-feetPlayerPos_normalized.y*5.0 + 0.5 ,0.0,1.0),2.0)); // darken the ground in the sky. + // Background *= 1.0 - exp2(-50.0 * pow(clamp(feetPlayerPos_normalized.y+0.025,0.0,1.0),2.0) ); // darken the ground in the sky. vec3 Sky = skyFromTex(feetPlayerPos_normalized, colortex4)/30.0; Background += Sky; @@ -802,22 +835,17 @@ void main() { #ifdef END_SHADER - vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0); - LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition, LightPos1, LightPos2); - vec3 LightCol1 = vec3(0); vec3 LightCol2 = vec3(0); - LightSourceColors(LightCol1, LightCol2); - // LightCol1 *= Flashing; - LightCol2 *= Flashing; + float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0); + vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds); + + + float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + vec3 lightColors = LightSourceColors(vortexBounds, lightningflash); + + Direct_lighting += lightColors * GetShading(feetPlayerPos+cameraPosition, lightPos, slopednormal) ; - Direct_lighting += LightCol1 * GetShading(feetPlayerPos+cameraPosition, LightPos1, slopednormal) ; - - #if lightsourceCount == 2 - Direct_lighting += LightCol2 * GetShading(feetPlayerPos+cameraPosition, LightPos2, slopednormal); - #endif - // float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), viewPos, noise); - // if(!hand) Direct_lighting *= RT_Shadows*RT_Shadows; #endif ///////////////////////////////////////////////////////////////////////////////// @@ -849,7 +877,8 @@ void main() { #endif #ifdef END_SHADER - vec3 AmbientLightColor = vec3(1.0); + float fresnelGlow = pow(clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2),2); + vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow; #endif Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); @@ -889,11 +918,12 @@ void main() { if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0); DirectLightColor *= cloudShadow; } + + #endif ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// EFFECTS FOR INDIRECT ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - float SkySSS = 0.0; diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 774d1fd..84e20d4 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -253,10 +253,12 @@ void main() { vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, lightCol.rgb/80.0, averageSkyCol/30.0); #endif - #if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER + #if defined NETHER_SHADER || defined END_SHADER vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, noise_2); #endif + // VolumetricFog = vec4(0,0,0,1); + gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0); } diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 51a6c23..7c32c22 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -190,6 +190,7 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths){ if(DistortedAlpha <= 0.001) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents } +uniform float eyeAltitude; void main() { /* DRAWBUFFERS:73 */ @@ -294,9 +295,8 @@ void main() { #endif } -#ifdef OVERWORLD_SHADER - #ifdef Cave_fog - if (isEyeInWater == 0){ +#if defined OVERWORLD_SHADER && defined Cave_fog + if (isEyeInWater == 0 && eyeAltitude < 1500){ float fogdistfade = clamp( pow(length(fragpos) / far, CaveFogFallOff) ,0.0,1.0); @@ -310,12 +310,17 @@ void main() { #endif color.rgb = mix(color.rgb, cavefogCol*fogfade, fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ; - // color.rgb = mix(color.rgb, vec3(0.), fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ; - // color.rgb = vec3(CaveFogColor_R,CaveFogColor_G,CaveFogColor_B)*fogfade ; } - #endif #endif +#ifdef END_SHADER + if (isEyeInWater == 0){ + vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3; + + float hazeDensity = clamp(1.0 - length(fragpos) / max(far, 32.0 * 24.0),0.0,1.0); + color.rgb = mix(hazeColor, color.rgb, hazeDensity) ; + } +#endif // underwater fog if (isEyeInWater == 1){ float dirtAmount = Dirt_Amount; diff --git a/shaders/dimensions/composite5.fsh b/shaders/dimensions/composite5.fsh index 1dbfecb..ca85fb0 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -3,12 +3,12 @@ /* const int colortex0Format = RGBA16F; // low res clouds (deferred->composite2) + low res VL (composite5->composite15) -const int colortex1Format = RGBA16; //terrain gbuffer (gbuffer->composite2) -const int colortex2Format = RGBA16F; //forward + transparencies (gbuffer->composite4) -const int colortex3Format = R11F_G11F_B10F; //frame buffer + bloom (deferred6->final) -const int colortex4Format = RGBA16F; //light values and skyboxes (everything) -const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final) -const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4) +const int colortex1Format = RGBA16; // terrain gbuffer (gbuffer->composite2) +const int colortex2Format = RGBA16F; // forward + transparencies (gbuffer->composite4) +const int colortex3Format = R11F_G11F_B10F; // frame buffer + bloom (deferred6->final) +const int colortex4Format = RGBA16F; // light values and skyboxes (everything) +const int colortex6Format = R11F_G11F_B10F; // additionnal buffer for bloom (composite3->final) +const int colortex7Format = RGBA8; // Final output, transparencies id (gbuffer->composite4) const int colortex8Format = RGBA8; // Specular Texture const int colortex9Format = RGBA8; // rain in alpha const int colortex10Format = RGBA16; // resourcepack Skies diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index b960c40..e32aa0f 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -37,6 +37,7 @@ uniform mat4 gbufferModelView; uniform mat4 shadowModelView; uniform mat4 shadowProjection; uniform float sunElevation; +uniform vec3 sunPosition; uniform vec3 cameraPosition; // uniform float far; uniform ivec2 eyeBrightnessSmooth; @@ -95,6 +96,19 @@ void main() { gl_FragData[0] = vec4(0.0); float mixhistory = 0.06; +float accumuteSpeed = texelFetch2D(colortex4, ivec2(5,5), 0).r/150.0; + +vec2 pixelPos6 = vec2(5,5); + +if (gl_FragCoord.x > pixelPos6.x && gl_FragCoord.x < pixelPos6.x + 1 && gl_FragCoord.y > pixelPos6.y && gl_FragCoord.y < pixelPos6.y + 1){ + mixhistory = 0.1; + gl_FragData[0] = vec4(1,0,0,1); +} + +if(accumuteSpeed < 1.0) mixhistory = 1.0; + + + #ifdef OVERWORLD_SHADER /////////////////////////////// /// --- STORE COLOR LUT --- /// @@ -139,6 +153,8 @@ float mixhistory = 0.06; /// --- Sky only if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){ + + vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.+tempOffsets/256.,0.0,1.0); vec3 viewVector = cartToSphere(p); @@ -147,7 +163,7 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){ vec3 skyAbsorb = vec3(0.0); // float GroundDarkening = (exp2(-15 * clamp(-viewVector.y,0.0,1.0)) * 0.7+0.3); // darken the ground in the sky. - sky = calculateAtmosphere((averageSkyCol*4000./2.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise()); + sky = calculateAtmosphere((averageSkyCol*4000./2.0) , viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise()); // sky = mix(sky, (averageSkyCol + skyAbsorb)*4000./2.0, (1.0 - exp(pow(clamp(-viewVector.y+0.5,0.0,1.0),2) * -25))); @@ -167,14 +183,16 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0); vec3 viewVector = cartToSphere(p); + WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition); + vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0; - vec3 suncol = sunColor; + vec3 suncol = lightSourceColor; #ifdef ambientLight_only suncol = vec3(0.0); #endif - vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol, moonColor, skyGroundCol/30.0); + vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0); sky = sky*clouds.a + clouds.rgb / 5.0; vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), lightSourceColor*1.75, skyGroundCol/30.0); @@ -184,7 +202,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ } #endif -#if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER +#if defined NETHER_SHADER || defined END_SHADER vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0); //Sky gradient with clouds @@ -203,30 +221,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ } #endif - - // /* ---------------------- FOG SHADER ---------------------- */ - // vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0); - - // //Sky gradient with clouds - // if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){ - // vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2); - // vec3 viewVector = cartToSphere(p); - - // vec3 BackgroundColor = vec3(0.0); - - // vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887), fract(frameCounter/2.6180339887)); - - // BackgroundColor += VL_Fog.rgb/5.0; - - // gl_FragData[0] = vec4(BackgroundColor, 1.0); - - // } - #ifdef END_SHADER /* ---------------------- TIMER ---------------------- */ float flash = 0.0; - float maxWaitTime = 10; + float maxWaitTime = 5; float Timer = texelFetch2D(colortex4, ivec2(3,1), 0).x/150.0; Timer -= frameTime; @@ -247,7 +246,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec2 pixelPos1 = vec2(1,1); if (gl_FragCoord.x > pixelPos1.x && gl_FragCoord.x < pixelPos1.x + 1 && gl_FragCoord.y > pixelPos1.y && gl_FragCoord.y < pixelPos1.y + 1){ - mixhistory = clamp(5.0 * frameTime,0.0,1.0); + mixhistory = clamp(4.0 * frameTime,0.0,1.0); gl_FragData[0] = vec4(flash, 0.0, 0.0, 1.0); } @@ -259,7 +258,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec3 LastPos = (texelFetch2D(colortex4,ivec2(2,1),0).xyz/150.0) * 2.0 - 1.0; - LastPos += (hash31(frameCounter / 75) * 2.0 - 1.0); + LastPos += (hash31(frameCounter / 50) * 2.0 - 1.0); LastPos = LastPos * 0.5 + 0.5; if(Timer > maxWaitTime * 0.7 ){ @@ -277,8 +276,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ //Temporally accumulate sky and light values vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb; vec3 curr = gl_FragData[0].rgb*150.; + + gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.); + //Exposure values if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) gl_FragData[0] = vec4(exposure, avgBrightness, avgL2,1.0); diff --git a/shaders/dimensions/deferred.vsh b/shaders/dimensions/deferred.vsh index 1bb5e38..024e392 100644 --- a/shaders/dimensions/deferred.vsh +++ b/shaders/dimensions/deferred.vsh @@ -41,6 +41,7 @@ uniform float rainStrength; // uniform int worldTime; vec3 sunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); + // vec3 sunVec = normalize(LightDir); #include "/lib/sky_gradient.glsl" @@ -104,16 +105,11 @@ void main() { pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90); averageSkyCol_Clouds += 2.0*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.; - - // pos = normalize(vec3(0,1,0)); - // pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90); - averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.; // please dont do an infinite feedback loop.... - + + averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.; } - - /// TOOO DAMN BLUE - // // only need to sample one spot for this - // averageSkyCol += 2.0*skyFromTex(normalize(vec3(0.0,1.0,0.0)),colortex4).rgb/150.; + + // only need to sample one spot for this vec3 minimumlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision); averageSkyCol_Clouds = max(averageSkyCol_Clouds, minimumlight); averageSkyCol = max(averageSkyCol, minimumlight); @@ -141,6 +137,8 @@ void main() { lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis; + + // WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition); #endif ////////////////////////////// diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index 30e364b..cfad4b9 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -93,7 +93,7 @@ void main() { vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1)); - vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80., moonColor/150., averageSkyCol/30.0); + vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80.0, averageSkyCol/30.0); gl_FragData[0] = VolumetricClouds; diff --git a/shaders/dimensions/deferred2.vsh b/shaders/dimensions/deferred2.vsh index e743c70..ad495e3 100644 --- a/shaders/dimensions/deferred2.vsh +++ b/shaders/dimensions/deferred2.vsh @@ -29,7 +29,7 @@ void main() { sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb; moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb; - WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) *sunPosition); + WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition); // WsunVec = normalize(LightDir); tempOffsets = HaltonSeq2(frameCounter%10000); diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 243fe00..308a65a 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -145,6 +145,9 @@ screen.Fog = Fog Settings option.CaveFogColor_G = Fog G option.CaveFogColor_B = Fog B + screen.END_AND_NETHER_FOG = Nether/End Fog + option.END_STORM_DENSTIY = End Storm Density + option.PLUME_DENSITY = Nether Smoke Density screen.Clouds = Cloud Settings option.VOLUMETRIC_CLOUDS = Volumetric Clouds @@ -502,4 +505,7 @@ option.RESOURCEPACK_SKY.comment = Toggle resourcepack sky support. Configure set option.MATERIAL_AO.comment = Toggle the use of ambient occlusion based on what the resourcepack provides. §aPERFORMANCE COST:§r very low option.WATER_WAVE_STRENGTH.comment = configure how strong the waves appear. -option.MOONPHASE_BASED_MOONLIGHT.comment = §bWhat is this?§r every night, the moon has different lighting. This setting adjusts the moonlight brightness based on how much of the moon is glowing. §aPERFORMANCE COST:§r nearly nothing \ No newline at end of file +option.MOONPHASE_BASED_MOONLIGHT.comment = §bWhat is this?§r every night, the moon has different lighting. This setting adjusts the moonlight brightness based on how much of the moon is glowing. §aPERFORMANCE COST:§r nearly nothing + +option.END_STORM_DENSTIY.comment = §bWhat is this?§r This is the dark cloudy fog in the end. Confingure the density of the end storm. +option.PLUME_DENSITY.comment = §bWhat is this?§r This is the thick, glowing smoke towers in the nether. Confingure the density of the nether smoke. \ No newline at end of file diff --git a/shaders/lib/DailyWeatherSettings.glsl b/shaders/lib/DailyWeatherSettings.glsl deleted file mode 100644 index bb31c23..0000000 --- a/shaders/lib/DailyWeatherSettings.glsl +++ /dev/null @@ -1,3 +0,0 @@ -#if Cumulus_coverage == 1.0 - variable.float.VariableCoverage = 1.0 -#endif \ No newline at end of file diff --git a/shaders/lib/clouds.glsl b/shaders/lib/clouds.glsl deleted file mode 100644 index 3c0cd79..0000000 --- a/shaders/lib/clouds.glsl +++ /dev/null @@ -1,16 +0,0 @@ -vec3 cloud2D(vec3 viewPos,vec3 col){ - vec3 wpos = viewPos; - float wind = frameTimeCounter/200.; - vec2 intersection = ((2000.0-cameraPosition.y)*wpos.xz*inversesqrt(wpos.y+cameraPosition.y/512.-50./512.) + cameraPosition.xz+wind)/40000.; - - - float phase = pow(clamp(dot(viewPos,sunVec),0.,1.),2.)*0.5+0.5; - - float fbm = clamp((texture2D(noisetex,intersection*vec2(1.,1.5)).a + texture2D(noisetex,intersection*vec2(2.,7.)+wind*0.4).a/2.)-0.5*(1.0-rainStrength),0.,1.) ; - - - - - return mix(col,6.*(vec3(0.9,1.2,1.5)*skyIntensityNight*0.02*(1.0-rainStrength*0.9)+17.*phase*nsunColor*skyIntensity*0.7*(1.0-rainStrength*0.9)),0.0*(fbm*fbm)*(fbm*fbm)*(fbm*clamp(wpos.y*0.9,0.,1.))); - -} \ No newline at end of file diff --git a/shaders/lib/end_fog.glsl b/shaders/lib/end_fog.glsl index 6b96895..25076ca 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -63,35 +63,33 @@ SOFTWARE.*/ //---------------------------------------------------------------------------------------- // vec3 RandomPosition = hash31(frameTimeCounter); +float vortexBoundRange = 300.0; vec3 ManualLightPos = vec3(ORB_X, ORB_Y, ORB_Z); -// int switcher = frameCounter % 2 == 0 ? 0 : 1; +vec3 LightSourcePosition(vec3 worldPos, vec3 cameraPos, float vortexBounds){ -// float OneOrZero = int(mod(gl_FragCoord.x*gl_FragCoord.y + switcher, 2)); + // this is static so it can just sit in one place + vec3 vortexPos = worldPos - vec3(0.0,200.0,0.0); -void LightSourcePosition(vec3 WorldPos, vec3 CameraPos, inout vec3 Pos1, inout vec3 Pos2){ + vec3 lightningPos = worldPos - cameraPos - ManualLightPos; + + // snap-to coordinates in worldspace. + float cellSize = 200.0; + lightningPos += fract(cameraPos/cellSize)*cellSize - cellSize*0.5; - Pos1 = WorldPos - vec3(0,200,0); - // Pos2 = WorldPos - vec3(-50,100,0); - // Pos1 = mix(Pos1, Pos2, OneOrZero); + // make the position offset to random places (RNG.xyz from non-clearing buffer). + vec3 randomOffset = (texelFetch2D(colortex4,ivec2(2,1),0).xyz / 150.0) * 2.0 - 1.0; + lightningPos -= randomOffset * 2.5; + + #ifdef THE_ORB + cellSize = 200.0; + vec3 orbpos = worldPos - cameraPos - ManualLightPos;// - vec3(sin(frameTimeCounter), cos(frameTimeCounter), cos(frameTimeCounter))*100; + orbpos += fract(cameraPos/cellSize)*cellSize - cellSize*0.5; - - - vec3 Origin = WorldPos - CameraPos - ManualLightPos; - - float cellSize = 200; - vec3 cellPos = CameraPos ; - - Origin += fract(cellPos/cellSize)*cellSize - cellSize*0.5; - // Origin -= vec3(sin(frameTimeCounter),0,-cos(frameTimeCounter)) * 20; - - vec3 randomPos = texelFetch2D(colortex4,ivec2(2,1),0).xyz / 150.0; - - Origin -= (randomPos * 2.0 - 1.0); - - // Pos1 = mix(Pos1, Origin, OneOrZero); - - Pos2 = Origin; + return orbpos; + #else + return mix(lightningPos, vortexPos, vortexBounds); + #endif } float densityAtPosFog(in vec3 pos){ @@ -134,39 +132,41 @@ void VolumeBounds(inout float Volume, vec3 Origin){ float thickness = 50.0 * radius; float Torus = (thickness - clamp( pow( length( vec2(length(Origin.xz) - radius, Origin2.y) ),2.0) - radius, 0.0, thickness) ) / thickness; - Origin2.xz *= 0.3; + Origin2.xz *= 0.5; Origin2.y -= 100; - float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.5,0.0,1.0); - Volume = max(Volume - Bounds - Torus, orb); + float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.0,0.0,1.0); + Volume = max(Volume - Bounds - Torus, 0); } // create the volume shape -float cloudVol(in vec3 pos){ +float fogShape(in vec3 pos){ + float vortexBounds = clamp(vortexBoundRange - length(pos), 0.0,1.0); + vec3 samplePos = pos*vec3(1.0,1.0/48.0,1.0); + float fogYstart = -60; - float Output = 0.0; - vec3 samplePos = pos*vec3(1.0,1./48.,1.0); + + // this is below down where you fall to your death. + float voidZone = max(exp2(-1.0 * sqrt(max(pos.y - -60,0.0))) ,0.0) ; - // swirly swirly :DDDDDDDDDDD + // swirly swirly :DDDDDDDDDDD SwirlAroundOrigin(samplePos, pos); - - float NoisePlane = texture2D(noisetex, samplePos.xz/1024 ).b; - - float MainShape = clamp(max(0.5 - densityAtPosFog(samplePos * 16),0.0) * 2,0.0,1.0); - float Erosion = abs(0.6 - densityAtPosFog(samplePos * (160. - MainShape*50) - vec3(0,frameTimeCounter*3,0) )); + + float noise = densityAtPosFog(samplePos * 12.0); + float erosion = 1.0-densityAtPosFog((samplePos - frameTimeCounter/20) * (124 + (1-noise)*7)); - Output = MainShape; - Output = max(Output - Erosion*0.5,0.0); - // apply limts - VolumeBounds(Output, pos); + float clumpyFog = max(exp(noise * -mix(10,4,vortexBounds))*mix(2,1,vortexBounds) - erosion*0.3, 0.0); + + // apply limts + VolumeBounds(clumpyFog, pos); - // Output = max(max(100 - pos.y,0.0) - NoisePlane * 50 ,0.0); - return Output; + + return clumpyFog + voidZone; } -float EndLightMie(vec3 LightPos){ +float endFogPhase(vec3 LightPos){ float mie = exp(length(LightPos) / -150); mie *= mie; @@ -176,49 +176,50 @@ float EndLightMie(vec3 LightPos){ return mie; } -void LightSourceColors(inout vec3 Color1, inout vec3 Color2){ - // Color1 = vec3(0.7,0.88,1.0); - // Color2 = vec3(ORB_R,ORB_G,ORB_B); - Color1 = vec3(1.0,0.5,1.0); - Color2 = vec3(0.0,0.5,1.0); +vec3 LightSourceColors(float vortexBounds, float lightningflash){ - // Color1 = mix(Color1, Color2, OneOrZero); + // vec3 vortexColor = vec3(0.7,0.88,1.0); + // vec3 lightningColor = vec3(ORB_R,ORB_G,ORB_B); + + vec3 vortexColor = vec3(0.5,0.68,1.0); + vec3 lightningColor = vec3(1.0,0.3,0.2) * lightningflash; + + #ifdef THE_ORB + return vec3(ORB_R, ORB_G, ORB_B) * ORB_ColMult; + #else + return mix(lightningColor, vortexColor, vortexBounds); + #endif } -vec3 LightSourceLighting( vec3 WorldPos, vec3 LightPos, float Dither, float VolumeDensity, vec3 LightColor, float Phase ){ +vec3 LightSourceLighting(vec3 startPos, vec3 lightPos, float noise, float density, vec3 lightColor, float vortexBound){ - float Mie = EndLightMie(LightPos); - float Shadow = 0.0; + float phase = endFogPhase(lightPos); + float shadow = 0.0; - // vec3 shadowSamplePos = WorldPos - LightPos * 0.05; - - for (int j=0; j < 3; j++){ - // shadowSamplePos -= LightPos * 0.25 * Dither * min(j,1); - vec3 shadowSamplePos = WorldPos - LightPos * (0.05 + j * (0.25 + Dither*0.15)); - Shadow += cloudVol(shadowSamplePos); + for (int j = 0; j < 3; j++){ + vec3 shadowSamplePos = startPos - lightPos * (0.05 + j * (0.25 + noise*0.15)); + shadow += fogShape(shadowSamplePos); } - vec3 FinalLighting = LightColor * Mie * exp(Shadow * -5.0) ; + vec3 finalLighting = lightColor * phase * exp(shadow * -10.0); - FinalLighting += LightColor * exp2(-5 * max(2.5-Shadow,0.0) * vec3(1.2,1.0,0.8+VolumeDensity*0.4)) * (Mie*Mie) * clamp((1.0 - length(LightPos) / 100.0),0.0,1.0); + finalLighting += lightColor * phase*phase * (1.0-exp((shadow*shadow*shadow) * vec3(0.6,2.0,2) * -1)) * (1.0 - exp(-density*density)); - return FinalLighting; + return finalLighting; } - -#define lightsourceCount 2 // [1 2] - vec4 GetVolumetricFog( - vec3 viewPos, + vec3 viewPosition, float dither, float dither2 ){ - int SAMPLES = 16; - vec3 vL = vec3(0.0); - float absorbance = 1.0; - //project pixel position into projected shadowmap space - vec3 wpos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + /// ------------- RAYMARCHING STUFF ------------- \\\ + + int SAMPLES = 16; + + //project pixel position into projected shadowmap space + vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz; vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz; fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz; @@ -228,91 +229,67 @@ vec4 GetVolumetricFog( //rayvector into projected shadow map space //we can use a projected vector because its orthographic projection //however we still have to send it to curved shadow map space every step - vec3 dV = fragposition-start; + vec3 dV = fragposition - start; vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz); float maxLength = min(length(dVWorld),32.0 * 12.0)/length(dVWorld); - dV *= maxLength; dVWorld *= maxLength; - float dL = length(dVWorld); + + vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition; + + /// ------------- COLOR/LIGHTING STUFF ------------- \\\ + + vec3 color = vec3(0.0); + vec3 absorbance = vec3(1.0); + vec3 fogcolor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.05)) ; - vec3 LightCol1 = vec3(0); vec3 LightCol2 = vec3(0); - LightSourceColors(LightCol1, LightCol2); - - float Flashing = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; - // LightCol1 *= Flashing; - LightCol2 *= Flashing; - - - vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0); - - LightSourcePosition(cameraPosition, cameraPosition, LightPos1, LightPos2); - - float Phase1 = sqrt(1.0 - clamp( dot(normalize(dVWorld), normalize(-LightPos1)),0.0,1.0)); - Phase1 = exp(Phase1 * -5.0) * 10; - - float Phase2 = sqrt(1.0 - clamp( dot(normalize(dVWorld), normalize(-LightPos2)),0.0,1.0)); - Phase2 = exp(Phase2 * -5.0) * 10; - + float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; float expFactor = 11.0; for (int i=0;i 0.0){ SampleCoords0 = -( (samplePos.zx + cloud_movement*2) / 15000); SampleCoords1 = -( (samplePos.zx - cloud_movement*2) / 1500); } - float CloudLarge = texture2D(noisetex, SampleCoords0 ).b+thedistance; - float CloudSmall = texture2D(noisetex, SampleCoords1 ).r+thedistance; + float CloudSmall = texture2D(noisetex, SampleCoords1 ).r + thedistance; + float CloudLarge = texture2D(noisetex, SampleCoords0 ).b + thedistance; + float coverage = abs(pow(CloudLarge,1)*2.0 - 1.2)*0.5 - (1.0-CloudSmall); + + float FirstLayerCoverage = DailyWeather_Cumulus(coverage); /////// FIRST LAYER @@ -91,14 +97,14 @@ float cloudCov(in vec3 pos, vec3 samplePos, float minHeight, float maxHeight){ float cloudVol(in vec3 pos,in vec3 samplePos,in float cov, in int LoD, float minHeight, float maxHeight){ float upperPlane = 1.0 - clamp(pos.y - (maxHeight + 80),0.0,1.0); - float noise = 0.0 ; float totalWeights = 0.0; float pw = log(fbmPower1); float pw2 = log(fbmPower2); samplePos.xz -= cloud_movement/4; - + + // WIND samplePos.xz += pow( max(pos.y - (minHeight+20), 0.0) / 20.0,1.50) * upperPlane; noise += (1.0-densityAtPos(samplePos * mix(100.0,200.0,upperPlane)) ) * mix(2.0,1.0,upperPlane); @@ -147,9 +153,7 @@ float GetAltostratusDensity(vec3 pos){ } #ifndef CLOUDSHADOWSONLY - -uniform sampler2D colortex4;//Skybox - +uniform sampler2D colortex4; //Skybox //Mie phase function @@ -172,8 +176,6 @@ vec3 DoCloudLighting( vec3 sunMultiScatter, float distantfog - // float moonShadows, - // vec3 moonScatter ){ // float powder = 1.0 - exp((CloudShape*CloudShape) * -800); float powder = 1.0 - exp(densityFaded * -10); @@ -194,8 +196,7 @@ vec3 DoCloudLighting( vec4 renderClouds( vec3 FragPosition, vec2 Dither, - vec3 SunColor, - vec3 MoonColor, + vec3 LightColor, vec3 SkyColor ){ @@ -205,21 +206,24 @@ vec4 renderClouds( float total_extinction = 1.0; vec3 color = vec3(0.0); + float heightRelativeToClouds = clamp(1.0 - max(cameraPosition.y - (Cumulus_height+150),0.0) / 200.0 ,0.0,1.0); + ////////////////////////////////////////// ////// lighting stuff ////////////////////////////////////////// float shadowStep = 200.0; + vec3 dV_Sun = WsunVec*shadowStep; - float SdotV = dot(mat3(gbufferModelView)*WsunVec,normalize(FragPosition)); + float SdotV = dot(mat3(gbufferModelView)*WsunVec, normalize(FragPosition)); float mieDay = phaseg(SdotV, 0.75); float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ; - vec3 sunScattering = SunColor * mieDay * 3.14; - vec3 sunMultiScattering = SunColor * mieDayMulti * 4.0; + vec3 directScattering = LightColor * mieDay * 3.14; + vec3 directMultiScattering = LightColor * mieDayMulti * 4.0; - vec3 sunIndirectScattering = SunColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(FragPosition)), 0.5); + vec3 sunIndirectScattering = LightColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(FragPosition)), 0.5); ////////////////////////////////////////// @@ -234,7 +238,8 @@ vec4 renderClouds( vec3 dV_view = normalize(viewPos.xyz); - dV_view.y += 0.05; + + dV_view.y += 0.05 * heightRelativeToClouds; dV_view *= 300/abs(dV_view.y)/maxIT_clouds; @@ -252,51 +257,41 @@ vec4 renderClouds( float startFlip = mix(max(cameraPosition.y - MaxHeight_0 - 200,0.0), max(MinHeight_0 - cameraPosition.y,0), clamp(dV_view.y,0,1)); vec3 progress_view = dV_view*Dither.y + cameraPosition + dV_view/abs(dV_view.y) * startFlip; - float allDensities = Cumulus_density; - vec3 forg = normalize(dV_view); float distantfog = max(1.0 - clamp(exp2(pow(abs(forg.y),1.5) * -35.0),0.0,1.0),0.0); - // sunScattering *= distantfog; - // sunMultiScattering *= distantfog; - #ifdef Cumulus for(int i = 0; i < maxIT_clouds; i++) { // determine the base of each cloud layer bool isUpperLayer = max(progress_view.y - MinHeight_1,0.0) > 0.0; float CloudBaseHeights = isUpperLayer ? 200.0 + MaxHeight_0 : MaxHeight_0; - // if(isUpperLayer) allDensities = 0.25; float cumulus = GetCumulusDensity(progress_view, 1, MinHeight_0, MaxHeight_0); - float fadedDensity = allDensities * clamp(exp( (progress_view.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0); + float fadedDensity = Cumulus_density * clamp(exp( (progress_view.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0); if(cumulus > 1e-5){ float muE = cumulus*fadedDensity; - float sunLight = 0.0; - // float MoonLight = 0.0; + float directLight = 0.0; for (int j=0; j < 3; j++){ vec3 shadowSamplePos = progress_view + dV_Sun * (0.1 + j * (0.1 + Dither.x*0.05)); - float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * allDensities; + float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * Cumulus_density; - sunLight += shadow; - // MoonLight += shadow; + directLight += shadow; } - if(max(progress_view.y - MaxHeight_1 + 50,0.0) < 1.0) sunLight += allDensities * 2.0 * GetCumulusDensity(progress_view + dV_Sun/abs(dV_Sun.y) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0); - + if(max(progress_view.y - MaxHeight_1 + 50,0.0) < 1.0) directLight += Cumulus_density * 2.0 * GetCumulusDensity(progress_view + dV_Sun/abs(dV_Sun.y) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0); - float upperLayerOcclusion = !isUpperLayer ? allDensities * 2.0 * GetCumulusDensity(progress_view + vec3(0.0,1.0,0.0) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0) : 0.0; - float skylightOcclusion = max(exp2((upperLayerOcclusion*upperLayerOcclusion) * -5), 0.5 + (1.0-distantfog)*0.5); + float upperLayerOcclusion = !isUpperLayer ? Cumulus_density * 2.0 * GetCumulusDensity(progress_view + vec3(0.0,1.0,0.0) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0) : 0.0; + float skylightOcclusion = max(exp2((upperLayerOcclusion*upperLayerOcclusion) * -5), 0.75 + (1.0-distantfog)*0.25); float skyScatter = clamp((CloudBaseHeights - 20 - progress_view.y) / 275.0,0.0,1.0); - vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor * skylightOcclusion, skyScatter, sunLight, sunScattering, sunMultiScattering, distantfog); - - // vec3 indirectSunlight = sunIndirectScattering * skylightOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2)) * exp((cumulus*cumulus) * -10.0) ; - // Lighting += indirectSunlight ; + vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor, skyScatter, directLight, directScattering, directMultiScattering, distantfog); + // a horrible approximation of direct light indirectly hitting the lower layer of clouds after scattering through/bouncing off the upper layer. + Lighting += sunIndirectScattering * skylightOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2)) * exp((cumulus*cumulus) * -10.0) ; ; color += max(Lighting - Lighting*exp(-mult*muE),0.0) * total_extinction; @@ -307,7 +302,6 @@ vec4 renderClouds( progress_view += dV_view; } #endif - return vec4(color, total_extinction); } @@ -351,6 +345,7 @@ float GetCloudShadow(vec3 feetPlayerPos){ return 1.0; #endif } + float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){ #ifdef CLOUDS_SHADOWS float MinHeight_0 = Cumulus_height; @@ -383,4 +378,4 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){ #else return 1.0; #endif -} \ No newline at end of file +} diff --git a/shaders/lib/waterBump.glsl b/shaders/lib/waterBump.glsl index d55b913..d490e5a 100644 --- a/shaders/lib/waterBump.glsl +++ b/shaders/lib/waterBump.glsl @@ -1,5 +1,5 @@ float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves - vec2 movement = vec2(frameTimeCounter*0.05);// *0; + vec2 movement = vec2(frameTimeCounter*0.05); vec2 pos = posxz ; float caustic = 1.0; float weightSum = 0.0; diff --git a/shaders/shaders.properties b/shaders/shaders.properties index fbf7bc3..e66368f 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -66,7 +66,7 @@ alphaTest.gbuffers_skybasic=false alphaTest.gbuffers_skytextured=false -sliders = FOG_START_HEIGHT Cumulus2_coverage WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH +sliders = PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT Cumulus2_coverage WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH screen.columns=2 screen = \ @@ -189,8 +189,8 @@ PhysicsMod_support [LabPBR] VL_SAMPLES RainFog_amount \ BLOOMY_FOG [TOD_fog] \ BorderFog [Cave_Fog] \ - Cloud_Fog PER_BIOME_ENVIRONMENT \ - FOG_START_HEIGHT + FOG_START_HEIGHT [END_AND_NETHER_FOG] \ + PER_BIOME_ENVIRONMENT @@ -203,8 +203,8 @@ PhysicsMod_support [LabPBR] screen.Fog_Color.columns=1 screen.Fog_Color = fog_coefficientRayleighR fog_coefficientRayleighG fog_coefficientRayleighB fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB - screen.NETHER_END_FOG.columns=2 - screen.NETHER_END_FOG = PLUME_DENSITY END_STORM_DENSTIY + screen.END_AND_NETHER_FOG.columns=2 + screen.END_AND_NETHER_FOG = END_STORM_DENSTIY PLUME_DENSITY ### WATER screen.Water.columns=2 @@ -241,7 +241,7 @@ PhysicsMod_support [LabPBR] ######## MISC SETTINGS screen.Misc_Settings.columns=1 - screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS + screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS screen.the_orb.columns = 1 screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B