Hello!
Im trying to implement cascaded shadowmaps into my game
Here is part of my fragment shader code:
float shadow(float bias)
{
float visibility = 0;
int index=1;
if(gl_FragCoord.z<1.0){ //1.0 is just for testing purposes, so it is always true
index=0; //when i change index here
}
vec4 shadowCoord=depthPV*vPos;
//and try to use it here, i get white triangles on screen, when i manualy change it to shadowMap[0] 1 or 2 it works as expected
if ( texture(shadowMap[index], shadowCoord.xy).z < shadowCoord.z+bias){
visibility = -1;
}
return visibility;
}