From 7ae86495bebfb61948ff77d56bb7d48455ecf3ac Mon Sep 17 00:00:00 2001 From: Merlin1809 Date: Mon, 8 Sep 2025 02:48:53 +0200 Subject: [PATCH] Slightly improve performance, reduce cloud light leaking around edges --- shaders/dimensions/composite1.fsh | 2 +- shaders/dimensions/composite2.fsh | 12 +++++++----- shaders/dimensions/fogBehindTranslucent_pass.fsh | 12 +++++++----- shaders/dimensions/prepare1.csh | 2 +- shaders/dimensions/prepare2.csh | 2 +- shaders/lang/en_us.lang | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index fc7bd5f..ac337be 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -487,7 +487,7 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo float dist = abs(linearSampledDepth - linearCurrentPos) / linearCurrentPos; // if (dist < 0.035){ - if (dist < 0.035/(1.0+linearCurrentPos) && (sampleDepth < newPos.z )) shadows = 0.0; + if (dist < 0.035/(1.0+linearCurrentPos)) shadows = 0.0; // if (dist < 0.3/(1.0+linearCurrentPos)) SSS += distanceScale2; if (dist < SSSdistanceScale) SSS += distanceScale2; diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 5df6b78..676d364 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -504,17 +504,19 @@ void main() { vec2 r2_sequence = R2_samples(seed).xy; vec2 BN = fract(r2_sequence + bnoise); - // vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize + texelSize*0.5; - vec2 tc = (gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize; + vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize + texelSize*0.5; + // vec2 tc = (gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize; - bool iswater = texture2D(colortex7,tc).a > 0.99; + // bool iswater = texture2D(colortex7,tc).a > 0.99; - float depth = texelFetch2D(depthtex0, ivec2(tc/texelSize),0).x; + ivec2 texcoord = ivec2(tc/texelSize); + + float depth = texelFetch2D(depthtex0, texcoord,0).x; float z0 = depth < 0.56 ? convertHandDepth(depth) : depth; #ifdef DISTANT_HORIZONS - float DH_z0 = texelFetch2D(dhDepthTex, ivec2(tc/texelSize),0).x; + float DH_z0 = texelFetch2D(dhDepthTex, texcoord,0).x; #else float DH_z0 = 0.0; #endif diff --git a/shaders/dimensions/fogBehindTranslucent_pass.fsh b/shaders/dimensions/fogBehindTranslucent_pass.fsh index 8d9c4a9..76bdacb 100644 --- a/shaders/dimensions/fogBehindTranslucent_pass.fsh +++ b/shaders/dimensions/fogBehindTranslucent_pass.fsh @@ -278,7 +278,7 @@ void main() { bool iswater = alpha > 0.99; - bool isLightning = alpha < 0.51 || alpha > 0.49; + bool isLightning = alpha < 0.51 && alpha > 0.49; ////////////////////////////////////////////////////////// ///////////////// BEHIND OF TRANSLUCENTS ///////////////// ////////////////////////////////////////////////////////// @@ -288,19 +288,21 @@ void main() { float noise_1 = R2_dither(); float noise_2 = blueNoise(); - float z0 = texelFetch2D(depthtex0, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x; + ivec2 texcoord = ivec2(tc/texelSize); + + float z0 = texelFetch2D(depthtex0, texcoord, 0 ).x; #ifdef DISTANT_HORIZONS - float DH_z0 = texelFetch2D(dhDepthTex, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;//texture2D(dhDepthTex,tc).x; + float DH_z0 = texelFetch2D(dhDepthTex, texcoord, 0 ).x;//texture2D(dhDepthTex,tc).x; #else float DH_z0 = 0.0; #endif - float z = texelFetch2D(depthtex1, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x; + float z = texelFetch2D(depthtex1, texcoord, 0 ).x; #ifdef DISTANT_HORIZONS // 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; + float DH_z = texelFetch2D(dhDepthTex1, texcoord, 0 ).x;//texture2D(dhDepthTex,tc).x; #else float DH_z = 0.0; #endif diff --git a/shaders/dimensions/prepare1.csh b/shaders/dimensions/prepare1.csh index 18d1751..d593370 100644 --- a/shaders/dimensions/prepare1.csh +++ b/shaders/dimensions/prepare1.csh @@ -124,7 +124,7 @@ void main() { // Pressure damping to prevent it from building up forever. float distFade = smoothstep(0.49*resolution.x, 0.4*resolution.x, dist); - pressure *= 0.992 * distFade; + pressure *= 0.985 * distFade; pVel *= distFade; if (onWaterSurface) { diff --git a/shaders/dimensions/prepare2.csh b/shaders/dimensions/prepare2.csh index c4dc9f7..9ed4d84 100644 --- a/shaders/dimensions/prepare2.csh +++ b/shaders/dimensions/prepare2.csh @@ -111,7 +111,7 @@ void main() { // Pressure damping to prevent it from building up forever. float distFade = smoothstep(0.49*resolution.x, 0.4*resolution.x, dist); - pressure *= 0.992 * distFade; + pressure *= 0.985 * distFade; pVel *= distFade; if (onWaterSurface) { diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index e35ccec..47ca25b 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -1,6 +1,6 @@ option.SHADER_VERSION_LABEL = §dECLIPSE§r - A Bliss Edit prefix.SHADER_VERSION_LABEL = V - value.SHADER_VERSION_LABEL.482 = 2.1.1 + value.SHADER_VERSION_LABEL.482 = 2.1.2 # if you're here to translate, this is not a joke, these do what they say profile.POTATO=§4Potato