intial changes for commit #495

This commit is contained in:
Xonk
2024-11-15 17:54:18 -05:00
committed by MikiP98
parent e81bb7eedc
commit 4869877f77
56 changed files with 3550 additions and 2274 deletions

View File

@ -11,16 +11,19 @@ void GriAndEminShadowFix(
float MinimumValue = 0.05;
// 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)/2048.0)*0.3;
// float ResMultiplier = 1.0 + (shadowDistance/8.0)*(1.0 - min(shadowMapResolution,2048)/2048.0)*0.3;
float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier;
vec3 Bias = FlatNormal * DistanceMultiplier;
// float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier;
float theDistance = max(1.0 - length(WorldPos) / shadowDistance,0.0);
float DistanceMultiplier = mix(0.5, 0.05, theDistance);
float DistanceMultiplier2 = mix(1.0, 0.02, theDistance);
vec3 Bias = (FlatNormal * DistanceMultiplier + WsunVec * DistanceMultiplier2);
// stop lightleaking by zooming up, centered on blocks
vec2 scale = vec2(0.5); scale.y *= 0.5;
vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y);
if(SkyLightmap < 0.1) Bias = zoomShadow;
vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y*0.1);
if(SkyLightmap < 0.1 && isEyeInWater != 1 && VanillaAO > 0.0) Bias = zoomShadow;
WorldPos += Bias;
}