Fix shadow rendering with filtering disabled

This commit is contained in:
Dmitry Kostenko 2021-11-10 00:31:02 +01:00 committed by x2048
parent 1175f48d05
commit a684a91bf5
2 changed files with 6 additions and 0 deletions

@ -187,6 +187,9 @@ float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDist
if (PCFBOUND == 0.0) return 0.0; if (PCFBOUND == 0.0) return 0.0;
// Return fast if sharp shadows are requested // Return fast if sharp shadows are requested
if (PCFBOUND == 0.0)
return 0.0;
if (SOFTSHADOWRADIUS <= 1.0) { if (SOFTSHADOWRADIUS <= 1.0) {
perspectiveFactor = getDeltaPerspectiveFactor(baseLength); perspectiveFactor = getDeltaPerspectiveFactor(baseLength);
return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS); return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS);

@ -181,6 +181,9 @@ float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDist
float perspectiveFactor; float perspectiveFactor;
// Return fast if sharp shadows are requested // Return fast if sharp shadows are requested
if (PCFBOUND == 0.0)
return 0.0;
if (SOFTSHADOWRADIUS <= 1.0) { if (SOFTSHADOWRADIUS <= 1.0) {
perspectiveFactor = getDeltaPerspectiveFactor(baseLength); perspectiveFactor = getDeltaPerspectiveFactor(baseLength);
return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS); return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS);