Tweaks and fixes for DH chunk fade

This commit is contained in:
Merlin1809 committed 2025-04-11 20:57:00 +02:00
1 parent cd4f488767
commit d3d5c2b987
5 files changed
+29 -27

No files matched your search

+1 -1
View File
@@ -227,7 +227,7 @@ void main() {
#ifdef DH_CHUNK_FADING
float viewDist = length(localPos.xyz);
float ditherFade = smoothstep(max(far-6,6), far, viewDist);
float ditherFade = smoothstep(max(far-7,7), far-1, viewDist);
if (step(bayerDither(), ditherFade) == 0.0) {
discard;
-12
View File
@@ -454,17 +454,5 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[1] = vec4(Albedo, material);
}
#ifdef DH_CHUNK_FADING
#if defined DISTANT_HORIZONS
vec3 viewPos = pos.xyz;
float viewDist = length(mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz);
float ditherFade = smoothstep(max(far-32,32), far+4, viewDist);
if (step(bayerDither(), ditherFade) == 0.0) {
discard;
}
#endif
#endif
}
+17
View File
@@ -1,4 +1,5 @@
#include "/lib/settings.glsl"
#include "/lib/bayer_matrix.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
@@ -70,6 +71,8 @@ flat varying float HELD_ITEM_BRIGHTNESS;
uniform mat4 gbufferPreviousModelView;
uniform vec3 previousCameraPosition;
varying vec4 pos;
#include "/lib/util.glsl"
#include "/lib/projections.glsl"
@@ -491,6 +494,20 @@ void main() {
gl_FragData[0].rgb *= 0.1;
#endif
#if defined DISTANT_HORIZONS
#ifdef DH_CHUNK_FADING
float viewDist = length(mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz);
float ditherFade = smoothstep(0.98*far, 1.0*far, viewDist);
if (step(ditherFade, bayerDither()) == 0.0) {
discard;
}
#endif
#endif
#endif
}
+8 -11
View File
@@ -445,19 +445,16 @@ void main() {
//////////////////////////////// ////////////////////////////////
float textureLOD = bias();
#ifdef DH_CHUNK_FADING
#if defined DISTANT_HORIZONS
float viewDist = length(playerpos);
float ditherFade = smoothstep(0.98*far, 1.03*far, viewDist);
vec4 Albedo;
Albedo.rgb = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD).rgb * color.rgb;
Albedo.a = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD).a * color.a * step(ditherFade, bayerDither());
#else
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
#if defined DISTANT_HORIZONS
#ifdef DH_CHUNK_FADING
float viewDist = length(playerpos);
float ditherFade = smoothstep(0.98 * far, 1.03 * far, viewDist);
Albedo.a *= step(ditherFade, bayerDither());
#endif
#else
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
#endif
#if defined HAND
+3 -3
View File
@@ -455,11 +455,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[0].a = 1.0/255.0;
}
#ifdef DH_CHUNK_FADING
#if defined DISTANT_HORIZONS
#if defined DISTANT_HORIZONS
#ifdef DH_CHUNK_FADING
float viewDist = length((mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz));
float ditherFade = smoothstep(1.03*far, 1.06*far, viewDist);
float ditherFade = smoothstep(0.98 * far, 1.03 * far, viewDist);
if (step(ditherFade, bayerDither()) == 0.0) {
discard;