diff --git a/shaders/composite1.fsh b/shaders/composite1.fsh index 7428cb1..5367e7e 100644 --- a/shaders/composite1.fsh +++ b/shaders/composite1.fsh @@ -902,7 +902,7 @@ void main() { SSS = SubsurfaceScattering_sun(albedo, SHADOWBLOCKERDEPTBH, LabSSS, clamp(dot(np3, WsunVec),0.0,1.0)) ; - // if (isEyeInWater == 0) SSS *= lightleakfix; // light leak fix + if (isEyeInWater == 0) SSS *= lightleakfix; // light leak fix #endif diff --git a/shaders/composite2.fsh b/shaders/composite2.fsh index 2c8b7d7..9ace1f7 100644 --- a/shaders/composite2.fsh +++ b/shaders/composite2.fsh @@ -211,7 +211,7 @@ void main() { vec3 fragpos = toScreenSpace(vec3(tc/RENDER_SCALE,z)); - + #ifdef Cloud_Fog vec4 VL_CLOUDFOG = InsideACloudFog(fragpos, vec2(R2_dither(),blueNoise()), lightCol.rgb/80., moonColor/150., (avgAmbient*2.0) * 8./150./3.); gl_FragData[0] = clamp(VL_CLOUDFOG,0.0,65000.); @@ -220,6 +220,7 @@ void main() { gl_FragData[0] = clamp(VL_Fog,0.0,65000.); #endif + } else { float dirtAmount = Dirt_Amount; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 8bbf5ed..6016f7f 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -112,7 +112,9 @@ #define CaveFog_amount 1 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25] -#define Cloud_Fog // render the VL clouds a second time along with VL fog so you can fly through it and stuff. expect a noticeable performance hit. + + + // ----- TIME OF DAY FOG ----- // #define TOD_Fog_mult 1.0 // [0.0 0.25 0.5 0.75 1.0 2.0 3.0 4.0 5.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0] @@ -304,7 +306,10 @@ const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] THIS WILL BREAK SUBSURF #define Daily_Weather // different skies and fog for different days. #ifdef VOLUMETRIC_CLOUDS + #define Cloud_Fog // render the VL clouds a second time along with VL fog so you can fly through it and stuff. expect a noticeable performance hit. + #define CLOUDS_SHADOWS // Casts shadows from clouds on the world + #ifdef CLOUDS_SHADOWS #define VL_CLOUDS_SHADOWS // Casts shadows from clouds on VL #endif diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index a243bcc..932f536 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -215,7 +215,7 @@ vec4 renderClouds( vec3 dV_view = normalize(fragpos.xyz); - dV_view.y += 0.05; + // dV_view.y += 0.05; vec3 dV_view2 = dV_view; float mult2 = length(dV_view2); @@ -337,7 +337,7 @@ vec4 renderClouds( // Assume fog color = sky gradient at long distance vec3 fogColor = skyFromTex(normView, colortex4)/150. * 5.0; float dist = max(cameraPosition.y+CumulusHeight,max(CumulusHeight,150))/(abs(normView.y)+0.001); - float fog = exp(dist / -5000.0 * (1.0+rainCloudwetness*8.)); + float fog = exp(dist / -15000.0 * (1.0+rainCloudwetness*8.)); // if(IntersecTerrain) fog = 1.0; diff --git a/shaders/lib/volumetricFog.glsl b/shaders/lib/volumetricFog.glsl index d7f18dd..43944bb 100644 --- a/shaders/lib/volumetricFog.glsl +++ b/shaders/lib/volumetricFog.glsl @@ -146,7 +146,7 @@ vec4 getVolumetricRays( - +/// really dumb lmao vec4 InsideACloudFog( vec3 fragpos, vec2 Dither, @@ -154,10 +154,6 @@ vec4 InsideACloudFog( vec3 MoonColor, vec3 SkyColor ){ - // #ifndef VOLUMETRIC_CLOUDS - // return vec4(0.0,0.0,0.0,1.0); - // #endif - float total_extinction = 1.0; vec3 color = vec3(0.0); @@ -184,13 +180,13 @@ vec4 InsideACloudFog( vec3 progress = start.xyz; vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition; + vec3 progress_view = vec3(0.0); float expFactor = 11.0; ////// lighitng stuff float shadowStep = 200.; vec3 dV_Sun = normalize(mat3(gbufferModelViewInverse)*sunVec)*shadowStep; - vec3 dV_Sun_small = dV_Sun/shadowStep; float SdotV = dot(sunVec,normalize(fragpos)); @@ -200,23 +196,24 @@ vec4 InsideACloudFog( vec3 Fog_SkyCol = SkyColor; vec3 Fog_SunCol = SunColor; - - // if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun; - float mieDay = phaseg(SdotV, 0.75) * 3.14; - float mieDayMulti = phaseg(SdotV, 0.35) * 2; - - vec3 sunContribution = SunColor * mieDay; - vec3 sunContributionMulti = SunColor * mieDayMulti ; - - float mieNight = (phaseg(-SdotV,0.8) + phaseg(-SdotV, 0.35)*4); - vec3 moonContribution = MoonColor * mieNight; - - float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0); - ///////// fog part + float mieDay = phaseg(SdotV, 0.75) * 3.14; + float mieDayMulti = phaseg(SdotV, 0.35) * 2; + + vec3 sunContribution = SunColor * mieDay; + vec3 sunContributionMulti = SunColor * mieDayMulti ; + + float mieNight = (phaseg(-SdotV,0.8) + phaseg(-SdotV, 0.35)*4); + vec3 moonContribution = MoonColor * mieNight; + + float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0); + + + + //Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx) float mie = phaseg(SdotV,0.7)*5.0 + 1.0; @@ -233,60 +230,61 @@ vec4 InsideACloudFog( float mu = 1.0; float muS = mu; + + float Shadows_for_Fog = 0.0; - #ifdef Cumulus - for (int i=0;i 1e-5){ @@ -314,7 +312,7 @@ vec4 InsideACloudFog( float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos); Sunlight += HighAlt_shadow; #endif - + float ambientlightshadow = 1.0 - clamp(exp((progress_view.y - (MaxCumulusHeight - 50)) / 100.0),0.0,1.0) ; vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view, timing); @@ -323,12 +321,7 @@ vec4 InsideACloudFog( total_extinction *= max(exp(-mult*muE),0.0); } - - - - if (total_extinction < 1e-5) break; - } - #endif - + if (total_extinction < 1e-5) break; + } return vec4(color, total_extinction); } \ No newline at end of file