We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d25a68 commit bcbdb8dCopy full SHA for bcbdb8d
Shaders/ShadowMapping/Scene.frag
@@ -126,8 +126,16 @@ void main()
126
127
128
// 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);
+ //vec4 res = step(viewPos.z, shadowUBO.splitDepths);
+ //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
139
140
vec4 shadowPos = biasMat * shadowUBO.lightSpaceMatrices[cascadeIndex] * vec4(worldPos, 1.0);
141
0 commit comments