From 7c1e6c02616ce70e32aa8190135e065b95358428 Mon Sep 17 00:00:00 2001 From: Merlin1809 <88194861+Merlin1809@users.noreply.github.com> Date: Tue, 2 Dec 2025 03:51:55 +0100 Subject: [PATCH] fix background reflection in low light level areas with dh/voxy --- shaders/lib/specular.glsl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index bb110ad..989c1a0 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -193,27 +193,26 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo float sp = invLinZ(sqrt(sampleDepth)); #else #ifdef FULLRESDEPTH - float sp = texelFetch(depthtex0, ivec2(spos.xy/texelSize),0).r; + float sp = texelFetch(depthtex0, ivec2(spos.xy/texelSize),0).r; #else - float sp = texelFetch(depthtex1, ivec2(spos.xy/texelSize),0).r; + float sp = texelFetch(depthtex1, ivec2(spos.xy/texelSize),0).r; #endif #endif #if (defined VOXY && defined VOXY_REFLECTIONS) || (defined DISTANT_HORIZONS && defined DH_SCREENSPACE_REFLECTIONS) - bool DHrange = sp >= 1.0; - if (DHrange){ + if (sp >= 1.0){ #ifdef QUARTER_RES_SSR #ifdef FULLRESDEPTH - sp = texelFetch(dhVoxyDepthTex, ivec2(spos2.xy/texelSize),0).r; + sp = texelFetch(dhVoxyDepthTex, ivec2(spos2.xy/texelSize),0).r; #else - sampleDepth = texelFetch(colortex12, ivec2(spos2.xy/texelSize/4.0),0).a/65000.0; - sp = DH_invLinZ(sqrt(sampleDepth)); + sampleDepth = texelFetch(colortex12, ivec2(spos2.xy/texelSize/4.0),0).a/65000.0; + sp = DH_invLinZ(sqrt(sampleDepth)); #endif #else #ifdef FULLRESDEPTH - sp = texelFetch(dhVoxyDepthTex, ivec2(spos2.xy/texelSize),0).r; + sp = texelFetch(dhVoxyDepthTex, ivec2(spos2.xy/texelSize),0).r; #else - sp = texelFetch(dhVoxyDepthTex1, ivec2(spos2.xy/texelSize),0).r; + sp = texelFetch(dhVoxyDepthTex1, ivec2(spos2.xy/texelSize),0).r; #endif #endif @@ -293,7 +292,7 @@ vec4 screenSpaceReflections( bool depthCheck = false; vec3 raytracePos = rayTraceSpeculars(reflectedVector, viewPos, noise, quality, isHand, reflectionLength, depthCheck); - if (raytracePos.z > 1.0) return reflection; + if (raytracePos.z > 1.001) return reflection; // use higher LOD as the reflection goes on, to blur it. this helps denoise a little. @@ -315,7 +314,7 @@ vec4 screenSpaceReflections( if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.y < 1.0) { if(raytracePos.z > 0.9999999) backgroundReflectMask = 1.0; - #if defined OVERWORLD_SHADER + #if defined OVERWORLD_SHADER reflection.a = raytracePos.z > 0.9999999 ? (isHand || isEyeInWater == 1 ? 1.0 : 0.0) : 1.0; #else reflection.a = 1.0;