Skip to content

Commit 732a8e6

Browse files
committed
pcf NoL
1 parent 6476a0a commit 732a8e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Shaders/ShadowMapping/PCF.glsl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
float ShadowPCF(vec4 shadowCoord, uint cascadeIndex)
22
{
3+
vec3 N = normalize(normal);
4+
vec3 L = normalize(shadowUBO.lightPosition.xyz - worldPos);
5+
float NoL = dot(N, L);
6+
37
ivec2 texDim = textureSize(shadowMap, 0).xy;
4-
float scale = shadowUBO.pcfScale;
8+
9+
// (1.0 - NoL) allows more blur for vertical surfaces
10+
float scale = shadowUBO.pcfScale + (1.0 - NoL);
511
float dx = scale * 1.0 / float(texDim.x);
612
float dy = scale * 1.0 / float(texDim.y);
713

8-
vec3 N = normalize(normal);
9-
vec3 L = normalize(shadowUBO.lightPosition.xyz - worldPos);
10-
float NoL = dot(N, L);
1114
float bias = max(shadowUBO.shadowMaxBias * (1.0 - NoL), shadowUBO.shadowMinBias);
1215

1316
// TODO Find out a better blurring technique concerning multiple shadow maps

0 commit comments

Comments
 (0)