tweak shadow bias to handle low resolutions better

This commit is contained in:
Xonk 2024-06-20 14:59:02 -04:00
parent 56ad3b059d
commit 60e807cfce
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,5 @@
option.SHADER_VERSION_LABEL = Bliss In-Dev Commit Number option.SHADER_VERSION_LABEL = Bliss In-Dev Version
prefix.SHADER_VERSION_LABEL = COMMIT #
# if you're here to translate, this is a joke, these don't do what they say # if you're here to translate, this is a joke, these don't do what they say
profile.QUALITY=Quality profile.QUALITY=Quality

View File

@ -7,15 +7,15 @@ void GriAndEminShadowFix(
float VanillaAO, float VanillaAO,
float SkyLightmap float SkyLightmap
){ ){
// #ifdef DISTANT_HORIZONS_SHADOWMAP
// float minimumValue = 0.3;
// #else
float minimumValue = 0.05;
// #endif
float DistanceOffset = max(length(WorldPos) * 0.005, minimumValue); float MinimumValue = 0.05;
vec3 Bias = FlatNormal * DistanceOffset; // give a tiny boost to the distance mulitplier when shadowmap resolution is below 2048.0
float ResMultiplier = 1.0 + (shadowDistance/8.0)*(1.0 - min(shadowMapResolution,2048.0)/2048.0)*0.3;
float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier;
vec3 Bias = FlatNormal * DistanceMultiplier;
// stop lightleaking by zooming up, centered on blocks // stop lightleaking by zooming up, centered on blocks
vec2 scale = vec2(0.5); scale.y *= 0.5; vec2 scale = vec2(0.5); scale.y *= 0.5;

View File

@ -1,4 +1,4 @@
#define SHADER_VERSION_LABEL 439 // [439] #define SHADER_VERSION_LABEL 458 // [439]
#define saturate(x) clamp(x,0.0,1.0) #define saturate(x) clamp(x,0.0,1.0)