From 61adeb5e8187b13634f08440bc297fb3e7073eac Mon Sep 17 00:00:00 2001 From: Xonk Date: Fri, 16 Jun 2023 00:33:50 -0400 Subject: [PATCH] unbreak cloud fog --- shaders/lib/ROBOBO_sky.glsl | 2 +- shaders/lib/volumetricClouds.glsl | 4 ++-- shaders/lib/volumetricFog.glsl | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/shaders/lib/ROBOBO_sky.glsl b/shaders/lib/ROBOBO_sky.glsl index cf75da3..ea37a29 100644 --- a/shaders/lib/ROBOBO_sky.glsl +++ b/shaders/lib/ROBOBO_sky.glsl @@ -142,7 +142,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s transmittance *= stepTransmittance ; } - + vec3 scattering = scatteringSun * sunColorBase + (scatteringAmbient) * background + scatteringMoon*moonColorBase ; // scattering = vec3(0,high_sun*255.,0); return scattering; diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index ca84df1..66a43b2 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -210,7 +210,7 @@ vec4 renderClouds( #endif float total_extinction = 1.0; vec3 color = vec3(0.0); - + float distancething = 1; //project pixel position into projected shadowmap space vec4 fragpos = normalize(gbufferModelViewInverse*vec4(FragPosition,1.0)); @@ -264,7 +264,7 @@ vec4 renderClouds( #ifdef Cumulus for(int i=0;i lViewPosM; // if(IntersecTerrain) break; float cumulus = GetCumulusDensity(progress_view, 1); diff --git a/shaders/lib/volumetricFog.glsl b/shaders/lib/volumetricFog.glsl index 85817a3..6e11890 100644 --- a/shaders/lib/volumetricFog.glsl +++ b/shaders/lib/volumetricFog.glsl @@ -15,6 +15,8 @@ float densityAtPosFog(in vec3 pos){ return mix(xy.r,xy.g, f.y); } +uniform float noPuddleAreas; + float cloudVol(in vec3 pos){ vec3 samplePos = pos*vec3(1.0,1./24.,1.0); @@ -32,13 +34,14 @@ float cloudVol(in vec3 pos){ float UniformFog = exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)); - float RainFog = max(fog_shape*10. - 7.,0.5) * exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)) * 5. * rainStrength * RainFog_amount; + float RainFog = max(fog_shape*10. - 7.,0.5) * exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)) * 5. * rainStrength * noPuddleAreas * RainFog_amount; TimeOfDayFog(UniformFog, CloudyFog); return CloudyFog + UniformFog + RainFog; } + vec4 getVolumetricRays( vec3 fragpos, float dither, @@ -133,7 +136,7 @@ vec4 getVolumetricRays( vec3 AtmosphericFog = skyCol0 * (rL+m) ; // extra fog effects - vec3 rainRays = (sunColor*sh) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1) * rainStrength * RainFog_amount; + vec3 rainRays = (sunColor*sh) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1) * rainStrength * noPuddleAreas * RainFog_amount; vec3 CaveRays = (sunColor*sh) * phaseg(SdotV,0.7) * 0.001 * (1.0 - max(eyeBrightnessSmooth.y,0)/240.); vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * max(eyeBrightnessSmooth.y,0)/240. + CaveRays ; @@ -274,7 +277,7 @@ vec4 InsideACloudFog( vec3 AtmosphericFog = Fog_SkyCol * (rL+m) ; // extra fog effects - vec3 rainRays = ((Fog_SunCol/5)*Shadows_for_Fog) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1.0) * rainStrength * RainFog_amount; + vec3 rainRays = ((Fog_SunCol/5)*Shadows_for_Fog) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1.0) * rainStrength * noPuddleAreas * RainFog_amount; vec3 CaveRays = (Fog_SunCol*Shadows_for_Fog) * phaseg(SdotV,0.7) * 0.001 * (1.0 - max(eyeBrightnessSmooth.y,0)/240.); vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * max(eyeBrightnessSmooth.y,0)/240. + CaveRays ; @@ -297,7 +300,7 @@ vec4 InsideACloudFog( for (int j=0; j < 3; j++){ - vec3 shadowSamplePos = progress_view + (dV_Sun * 0.015) * (1 + Dither.y/2 + j); + vec3 shadowSamplePos = progress_view + (dV_Sun * 0.15) * (1 + Dither.y/2 + j); float shadow = GetCumulusDensity(shadowSamplePos, 0) * Cumulus_density; @@ -321,8 +324,8 @@ vec4 InsideACloudFog( vec3 Sint = (S - S * exp(-mult*muE)) / muE; color += max(muE*Sint*total_extinction,0.0); total_extinction *= max(exp(-mult*muE),0.0); - } + } if (total_extinction < 1e-5) break; } return vec4(color, total_extinction);