diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index eedaf8a..180eb17 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -381,7 +381,7 @@ uniform int moonPhase; #define CloudLayer3 #define CloudLayer3_coverage 0.1 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3] #define CloudLayer3_density 0.1 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00] -#define CloudLayer3_height 5000.0 // [-300.0 -290.0 -280.0 -270.0 -260.0 -250.0 -240.0 -230.0 -220.0 -210.0 -200.0 -190.0 -180.0 -170.0 -160.0 -150.0 -140.0 -130.0 -120.0 -110.0 -100.0 -90.0 -80.0 -70.0 -60.0 -50.0 -40.0 -30.0 -20.0 -10.0 0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 110.0 120.0 130.0 140.0 150.0 160.0 170.0 180.0 190.0 200.0 210.0 220.0 230.0 240.0 250.0 260.0 270.0 280.0 290.0 300.0 310.0 320.0 330.0 340.0 350.0 360.0 370.0 380.0 390.0 400.0 410.0 420.0 430.0 440.0 450.0 460.0 470.0 480.0 490.0 500.0 510.0 520.0 530.0 540.0 550.0 560.0 570.0 580.0 590.0 600.0 700.0 800.0 900.0 1000.0 1250.0 1500.0 1750.0 2000.0 2250.0 2500.0 2750.0 3000.0 4000.0 5000.0] +#define CloudLayer3_height 7000.0 // [-300.0 -290.0 -280.0 -270.0 -260.0 -250.0 -240.0 -230.0 -220.0 -210.0 -200.0 -190.0 -180.0 -170.0 -160.0 -150.0 -140.0 -130.0 -120.0 -110.0 -100.0 -90.0 -80.0 -70.0 -60.0 -50.0 -40.0 -30.0 -20.0 -10.0 0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 110.0 120.0 130.0 140.0 150.0 160.0 170.0 180.0 190.0 200.0 210.0 220.0 230.0 240.0 250.0 260.0 270.0 280.0 290.0 300.0 310.0 320.0 330.0 340.0 350.0 360.0 370.0 380.0 390.0 400.0 410.0 420.0 430.0 440.0 450.0 460.0 470.0 480.0 490.0 500.0 510.0 520.0 530.0 540.0 550.0 560.0 570.0 580.0 590.0 600.0 700.0 800.0 900.0 1000.0 1250.0 1500.0 1750.0 2000.0 2250.0 2500.0 2750.0 3000.0 4000.0 5000.0 6000.0 7000.0] #define CloudLayer3_scale 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0] #if (defined CloudLayer0 || defined CloudLayer1) && defined VOLUMETRIC_CLOUDS diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 033512b..a6298b2 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -14,11 +14,9 @@ float randomSeed = fract(sin(dot(vec2(lightningTimer), vec2(12.9898,78.233))) * float lightningFlash = 4.0 * randomSeed; float getRainDensity(float currentDensity) { - float extraDensity = currentDensity; - if (currentDensity < 0.4) { - extraDensity = rainStrength * 0.2 + thunderStrength * 0.2; - } + float extraDensity = min(currentDensity * (1.0 + rainStrength * 0.1 + thunderStrength * 0.1), 1.0); + return extraDensity; } @@ -465,11 +463,7 @@ vec4 raymarchCloud( } #endif // altostratus layer -> all cumulus layers - #if defined CloudLayer3 - shadowStartPos = rayPosition + sunVector / abs(sunVector.y) * max(CloudLayer3_height - rayPosition.y, 0.0); - sunShadowMask += getCloudShape(CIRRUS_LAYER, 0, shadowStartPos, CloudLayer3_height, CloudLayer3_height) * parameters.cirrus.y * (1.0-abs(sunVector.y)); - #endif - #if defined CloudLayer2 + #if (defined CloudLayer0 && defined CloudLayer2) || (defined CloudLayer0 && defined CloudLayer2) shadowStartPos = rayPosition + sunVector / abs(sunVector.y) * max(CloudLayer2_height - rayPosition.y, 0.0); sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * parameters.altostratus.y * (1.0-abs(sunVector.y)); #endif @@ -636,12 +630,13 @@ vec4 GetVolumetricClouds( minHeight = CloudLayer1_height; maxHeight = cloudheight + minHeight; + cloudMix = clamp(smoothstep(minHeight - 400.0, minHeight + 45.0, cameraPosition.y),0.0,clamp(smoothstep(maxHeight + 300.0, maxHeight - 60.0, cameraPosition.y) ,0.0,1.0)); cloudDist.xz = mix(vec2(255.0), vec2(6.2), cloudMix); rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples); rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); vec2 cloudLayer1_Distance = vec2(startDistance, 1.0); - largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance); + if(smallCumulusClouds.a > 1e-5 || cameraPosition.y > CloudLayer1_height) largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance); #endif ////------- RENDER ALTOSTRATUS CLOUDS @@ -695,18 +690,6 @@ vec4 GetVolumetricClouds( cloudPlaneDistance = mix(cloudPlaneDistance, cloudLayer0_Distance.x, cloudLayer2_Distance.y); #endif #endif - #else - #ifdef CloudLayer1 - cloudPlaneDistance = mix(cloudPlaneDistance, cloudLayer1_Distance.x, cloudLayer3_Distance.y); - - #ifdef CloudLayer0 - cloudPlaneDistance = mix(cloudPlaneDistance, cloudLayer0_Distance.x, cloudLayer1_Distance.y); - #endif - #else - #ifdef CloudLayer0 - cloudPlaneDistance = mix(cloudPlaneDistance, cloudLayer0_Distance.x, cloudLayer3_Distance.y); - #endif - #endif #endif #elif defined CloudLayer2 cloudPlaneDistance = cloudLayer2_Distance.x;