mirror of
https://github.com/Merlin1809/Eclipse-Shader.git
synced 2026-10-10 04:53:07 +08:00
fix background reflection in low light level areas with dh/voxy
This commit is contained in:
+10
-11
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user