From 993c57a34a4e27d911b52b518edf2e0f0e76e8ac Mon Sep 17 00:00:00 2001 From: Xonk Date: Tue, 26 Dec 2023 13:35:35 -0500 Subject: [PATCH] disable a debug view i forgot to turn off hhaahah. fix distant SSS when contact shadows are off. --- shaders/dimensions/composite1.fsh | 8 ++++---- shaders/lib/volumetricClouds.glsl | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index 2df37fe..cec41f3 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -688,6 +688,7 @@ void main() { #ifdef OVERWORLD_SHADER NdotL = clamp((-15 + dot(slopednormal, WsunVec)*255.0) / 240.0 ,0.0,1.0); + float shadowNDOTL = NdotL; #ifndef Variable_Penumbra_Shadows @@ -795,15 +796,14 @@ void main() { if (!inShadowmapBounds) ShadowBlockerDepth = max(ShadowBlockerDepth, clamp(SS_shadowSSS,0.0,1.0)); - - // DEBUG = 1.0-SS_shadowSSS; #else - if (!inShadowmapBounds) Direct_SSS = vec3(0.0); + if (!inShadowmapBounds) ShadowBlockerDepth = 1.0-min(max(lightmap.y-0.85,0.0)*10.0,1.0); #endif - + Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), inShadowmapBounds) ; + } if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 957f55d..cf9fa9e 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -187,7 +187,7 @@ vec3 DoCloudLighting( vec3 sunLight = exp(sunShadows * -15 + powder ) * sunScatter; sunLight += exp(sunShadows * -3) * sunMultiScatter * (powder*0.7+0.3); - + // return skyLight; // return sunLight; return skyLight + sunLight; @@ -223,7 +223,7 @@ vec4 renderClouds( vec3 directScattering = LightColor * mieDay * 3.14; vec3 directMultiScattering = LightColor * mieDayMulti * 4.0; - vec3 sunIndirectScattering = LightColor * 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) * 3.14; ////////////////////////////////////////// @@ -234,7 +234,7 @@ vec4 renderClouds( vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) ); // maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT)); maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT)); - // maxIT_clouds = 30; + maxIT_clouds = 30; vec3 dV_view = normalize(viewPos.xyz); @@ -285,13 +285,14 @@ vec4 renderClouds( 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 ? 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.5 + (1.0-distantfog)*0.5); + 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, skyScatter, directLight, directScattering, directMultiScattering, distantfog); + vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor*skylightOcclusion, 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) ; ; + Lighting += sunIndirectScattering * exp((skyScatter*skyScatter) * cumulus * -35.0) * upperLayerOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2)); + color += max(Lighting - Lighting*exp(-mult*muE),0.0) * total_extinction;