Skip to content

Commit bcbdb8d

Browse files
committed
scene frag
1 parent 1d25a68 commit bcbdb8d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Shaders/ShadowMapping/Scene.frag

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,16 @@ void main()
126126

127127

128128
// Obtaining the cascadeIndex below is optimized for SHADOW_MAP_CASCADE_COUNT = 4
129-
vec4 res = step(viewPos.z, shadowUBO.splitDepths);
130-
uint cascadeIndex = uint(res.x + res.y + res.z + res.w);
129+
//vec4 res = step(viewPos.z, shadowUBO.splitDepths);
130+
//uint cascadeIndex = uint(res.x + res.y + res.z + res.w);
131+
uint cascadeIndex = 0;
132+
for (uint i = 0; i < SHADOW_MAP_CASCADE_COUNT - 1; ++i)
133+
{
134+
if (viewPos.z < shadowUBO.splitDepths[i])
135+
{
136+
cascadeIndex = i + 1;
137+
}
138+
}
131139

132140
vec4 shadowPos = biasMat * shadowUBO.lightSpaceMatrices[cascadeIndex] * vec4(worldPos, 1.0);
133141

0 commit comments

Comments
 (0)