From f4fd54a7f9b2c3059b55448ccfbec2d886311643 Mon Sep 17 00:00:00 2001 From: Xonk Date: Wed, 12 Aug 2026 00:26:38 -0400 Subject: [PATCH] fix AERIAL_PERSPECTIVE_TEST occluding higher clouds --- shaders/lib/volumetricClouds.glsl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 3b0af18..f73550a 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -349,8 +349,12 @@ vec4 raymarchCloud( vec3 newPos = rayPosition - cameraPosition; - #ifdef AERIAL_PERSPECTIVE_TEST - float skydensity = exp(-0.00035*length(newPos)); + #if defined AERIAL_PERSPECTIVE_TEST && !defined ReflectedFog + // float skydensity = exp(-0.00035*length(newPos)); + // float skydensity = exp(-0.00005*length(newPos)); + float scalexz = max(newPos.y*0.005,1); + float skydensity = exp(-0.00035*length(newPos / vec3(scalexz, 1.0, scalexz))); + float ifAboveOrBelowPlane = mix(-1.0, 1.0, clamp(cameraPosition.y - minHeight,0.0,1.0)) ; vec3 samplesky = skyFromTex(clamp(normalize(vec3(newPos.x,ifAboveOrBelowPlane*newPos.y,newPos.z)) - vec3(0,curvatureoffset - 0.005,0),-1,1) , colortex4).rgb/1200.0; @@ -433,8 +437,10 @@ vec4 raymarchCloud( vec3 newPos = rayPosition - cameraPosition; - #ifdef AERIAL_PERSPECTIVE_TEST - float skydensity = exp(-0.00035*length(newPos)); + #if defined AERIAL_PERSPECTIVE_TEST && !defined ReflectedFog + float scalexz = max(newPos.y*0.005,1); + float skydensity = exp(-0.00035*length(newPos / vec3(scalexz, 1.0, scalexz))); + float ifAboveOrBelowPlane = mix(-1.0, 1.0, clamp(cameraPosition.y - minHeight,0.0,1.0)) ; vec3 samplesky = skyFromTex(clamp(normalize(vec3(newPos.x,ifAboveOrBelowPlane*newPos.y,newPos.z)) - vec3(0,curvatureoffset - 0.005,0),-1,1) , colortex4).rgb/1200.0;