Hi,
I’m still new in the world of shadows and I implemented a cascaded shadow maps. It works fine in general, but I’m being puzzled with a stitched line that sometime happens between my splits.
You can see in this image the bug in between the 2 splits:
This isn’t the depth maps, this is the actual amount of shadows applied to the rendered scene.
This bug is seen in PCF, using shadow2DArray but it won’t happen if I do the depth comparison myself using texture2DArray, so I know my depth map is ok.
Here is the shader code I use:
float getShadowCoef(int nIndex, float fDist)
{
vec4 shadow_coord = shadTextMat[nIndex]*eyepos;
shadow_coord.w = shadow_coord.z;
shadow_coord.z = float(nIndex);
float ret = shadow2DArray(nTexUnit8, shadow_coord).x;
return ret;
}
float shadowCoef()
{
int index = 0;
float fDist = length(eyepos);
for (int ii=0; ii<nNumSplits; ii++)
{
if(fDist < far_d[ii])
{
index = ii;
break;
}
}
float coef = getShadowCoef(index, fDist);
return coef;
}
I tried forcing shadow_coord.w and shadow_coord.z to constant values, the stitching still occur. Making more tests has proven me the stitch is shared between the 2 splits (forcing a split to given value reduces the stitch, but doesn’t completely eliminates it.
FYI, I’m using a geForce GTX 580 with an up to date driver.
Has anyone seen something like this?
Thanks.