fix mishandling of cloud shadow related toggles. fix clouds not appearing behind translucent things. remove random spaces from shaders.properties

This commit is contained in:
Xonk
2025-03-17 00:47:19 -04:00
parent 294ee8b6f3
commit 7581c510b9
9 changed files with 90 additions and 95 deletions

View File

@ -368,9 +368,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
}
#endif
#ifdef CLOUDS_SHADOWS
Shadows *= GetCloudShadow(playerPos + cameraPosition, WsunVec);
#endif
Direct_lighting = DirectLightColor * NdotL * Shadows;

View File

@ -419,9 +419,7 @@ void main() {
Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2);
#ifdef CLOUDS_SHADOWS
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
#endif
if(isEyeInWater == 1){
float distanceFromWaterSurface = max(-(feetPlayerPos.y + (cameraPosition.y - waterEnteredAltitude)),0.0) ;

View File

@ -588,9 +588,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
// Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2);
#ifdef CLOUDS_SHADOWS
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
#endif
Direct_lighting = DirectLightColor * NdotL * Shadows;

View File

@ -1077,11 +1077,10 @@ void main() {
if(isEyeInWater != 1) SSSColor *= lightLeakFix;
#ifdef CLOUDS_SHADOWS
float cloudShadows = GetCloudShadow(feetPlayerPos.xyz + cameraPosition, WsunVec);
shadowColor *= cloudShadows;
SSSColor *= cloudShadow*cloudShadows;
#endif
#endif
#endif
@ -1351,16 +1350,13 @@ void main() {
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise_2)), 0.0, 65000.);
}
if(translucentMasks > 0.0 && isEyeInWater != 1){
// water absorbtion will impact ALL light coming up from terrain underwater.
gl_FragData[0].rgb *= Absorbtion;
if(translucentMasks > 0.0 && isEyeInWater != 1){
vec4 vlBehingTranslucents = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z));
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
}

View File

@ -328,9 +328,8 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
#endif
}
#ifdef VL_CLOUDS_SHADOWS
sh *= GetCloudShadow(progressW, WsunVec * lightCol.a);
#endif
#endif

View File

@ -191,7 +191,7 @@ vec4 waterVolumetrics( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estS
vec3 sh = vec3(1.0);
// do this outside raymarch loop, masking the water surface is good enough
#if defined VL_CLOUDS_SHADOWS && defined OVERWORLD_SHADER
#if defined OVERWORLD_SHADER
sh *= GetCloudShadow(wpos+cameraPosition, WsunVec);
#endif
@ -286,18 +286,19 @@ void main() {
float noise_1 = R2_dither();
float noise_2 = blueNoise();
float z0 = texture2D(depthtex0,tc).x;
float z0 = texelFetch2D(depthtex0, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;
#ifdef DISTANT_HORIZONS
float DH_z0 = texture2D(dhDepthTex,tc).x;
float DH_z0 = texelFetch2D(dhDepthTex, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;//texture2D(dhDepthTex,tc).x;
#else
float DH_z0 = 0.0;
#endif
float z = texture2D(depthtex1,tc).x;
float z = texelFetch2D(depthtex1, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;
#ifdef DISTANT_HORIZONS
float DH_z = texture2D(dhDepthTex1,tc).x;
// float DH_z = texture2D(dhDepthTex1,tc).x;
float DH_z = texelFetch2D(dhDepthTex1, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;//texture2D(dhDepthTex,tc).x;
#else
float DH_z = 0.0;
#endif
@ -355,14 +356,14 @@ void main() {
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);
float cloudPlaneDistance = 0.0;
if(!iswater){
#ifdef OVERWORLD_SHADER
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor,cloudPlaneDistance);
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor, cloudPlaneDistance);
float atmosphereAlpha = 1.0;
vec4 VolumetricFog = GetVolumetricFog(viewPos1, WsunVec, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb,cloudPlaneDistance);
finalVolumetrics.rgb += VolumetricClouds.rgb;
finalVolumetrics.a *= VolumetricClouds.a;
#endif
#if defined NETHER_SHADER || defined END_SHADER
@ -371,13 +372,16 @@ void main() {
finalVolumetrics.rgb = finalVolumetrics.rgb * VolumetricFog.a + VolumetricFog.rgb;
finalVolumetrics.a *= VolumetricFog.a;
}
vec4 underwaterVlFog = vec4(0,0,0,1);
float lightleakfix = clamp(lightmap.y + (1-caveDetection),0.0,1.0);
if(iswater && isEyeInWater != 1) finalVolumetrics = waterVolumetrics(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ,lightleakfix);
if(iswater && isEyeInWater != 1) {
vec4 underWaterFog = waterVolumetrics(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ,lightleakfix);
finalVolumetrics.rgb = finalVolumetrics.rgb * underWaterFog.a*underWaterFog.a + underWaterFog.rgb;
finalVolumetrics.a *= underWaterFog.a;
}
gl_FragData[0] = clamp(finalVolumetrics, 0.0, 65000.0);
}

View File

@ -206,9 +206,8 @@ vec4 GetVolumetricFog(
vec3 sh_forClouds = sh;
#endif
#ifdef VL_CLOUDS_SHADOWS
sh *= GetCloudShadow(progressW, sunVector);
#endif
#ifdef PER_BIOME_ENVIRONMENT
float maxDistance = inBiome * min(max(1.0 - length(d*dVWorld.xz)/(32*8),0.0)*2.0,1.0);

View File

@ -134,6 +134,7 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
vec3 startPosition = playerPos;
#ifdef CLOUDS_SHADOWS
float cloudShadows = 0.0;
#ifdef CloudLayer0
@ -154,6 +155,7 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
#if defined CloudLayer0 || defined CloudLayer1 || defined CloudLayer2
totalShadow *= exp((cloudShadows*cloudShadows) * -200.0);
#endif
#endif
return totalShadow;
}

View File

@ -150,7 +150,7 @@ SHADER_VERSION_LABEL <empty> \
######## LIGHTING
### DIRECT LIGHT
screen.Direct_Light.columns=1
screen.Direct_Light = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance
screen.Direct_Light =[Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance
screen.Shadows.columns=1
screen.Shadows = TRANSLUCENT_COLORED_SHADOWS SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS RENDER_PLAYER_SHADOWS entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance OPTIMIZED_SHADOW_DISTANCE
@ -182,7 +182,6 @@ SHADER_VERSION_LABEL <empty> \
screen.Resource_Pack_Support = [Reflections] [Emissives] [Subsurface_Scattering] [POM] [Porosity] MATERIAL_AO RESOURCEPACK_SKY
screen.Reflections.columns=2
# screen.Reflections = Specular_Reflections Sun_specular_Strength Screen_Space_Reflections reflection_quality Rough_reflections Roughness_Threshold Sky_reflection Dynamic_SSR_quality
screen.Reflections = \
DEFERRED_SPECULAR FORWARD_SPECULAR \
DEFERRED_ENVIORNMENT_REFLECTION FORWARD_ENVIORNMENT_REFLECTION \