I'm trying to create PCF from my Shadows but when I perform PCF filtering I get always 0.0
SamplerComparisonState cmpSampler
{
// sampler state
Filter = COMPARISON_MIN_MAG_MIP_LINEAR;
AddressU = MIRROR;
AddressV = MIRROR;
// sampler comparison state
ComparisonFunc = LESS_EQUAL;
};
..............
float2 texOffset( int u, int v )
{
return float2( u * 1.0f/2048.0f, v * 1.0f/2048.0f );
}
...............
//PCF sampling for shadow map
float sum = 0;
float x, y;
//perform PCF filtering on a 4 x 4 texel neighborhood
for (y = -1.5; y <= 1.5; y += 1.0)
{
for (x = -1.5; x <= 1.5; x += 1.0)
{
sum += localShadowTextures[1].SampleCmpLevelZero( cmpSampler, input.localLightViewPosition.xy + texOffset(x,y), input.localLightViewPosition.z );
}
}
float shadowFactor = sum / 16; // <--- no matter what i always get a 0 here.