So, I wanted to add cascaded shadow maps just to allow some additional shadowing mode for directional lights. And here I hit a wall with HLSL.
This code is seemingly alright:
DirectionalLight dirLight = (DirectionalLight)lightsData[lightInput.id];
...
// Just for the check - assign red/green/blue/yellow color to each cascade (along with storing index)
float3 cascadeMul = float3(0.0f, 0.0f, 0.0f);
int cascadeID = -1;
if (posz < dirLight.cascadeShadowClip[0])
{
cascadeID = 0;
cascadeMul = float3(1.0f, 0.0f, 0.0f);
}
else if (posz < dirLight.cascadeShadowClip[1])
{
cascadeID = 1;
cascadeMul = float3(0.0f, 1.0f, 0.0f);
}
else …