Jump to content

  • Log In with Google      Sign In   
  • Create Account


Percentage Closer Filtering


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 xlope01   Members   -  Reputation: 173

Like
0Likes
Like

Posted 09 August 2013 - 05:09 PM

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.


Edited by xlope01, 09 August 2013 - 05:10 PM.


Sponsor:

#2 MJP   Moderators   -  Reputation: 10816

Like
0Likes
Like

Posted 09 August 2013 - 05:30 PM

Are you creating your device with the D3D11_CREATE_DEVICE_DEBUG flag and checking for warnings/errors in your debugger output? It's possible that you messed something up when creating the sampler state, and that's screwing up the shader.



#3 NumberXaero   Prime Members   -  Reputation: 1398

Like
1Likes
Like

Posted 09 August 2013 - 10:16 PM

texOffset() takes ints, youre passing floats and returning floats?



#4 xlope01   Members   -  Reputation: 173

Like
0Likes
Like

Posted 10 August 2013 - 08:28 AM

Are you creating your device with the D3D11_CREATE_DEVICE_DEBUG flag and checking for warnings/errors in your debugger output? It's possible that you messed something up when creating the sampler state, and that's screwing up the shader.

 

I donot have D3D11_CREATE_DEVICE_DEBUG flag. Also I dident create sampler state for "cmpSampler" or you mean SamplerComparisonState ?



#5 xlope01   Members   -  Reputation: 173

Like
0Likes
Like

Posted 10 August 2013 - 08:29 AM

texOffset() takes ints, youre passing floats and returning floats?

 

good point, but this don't solve the problem.



#6 xlope01   Members   -  Reputation: 173

Like
0Likes
Like

Posted 14 August 2013 - 09:03 AM

Does anyone have any idea what is wrong with the SamplerComparisonState ?



#7 MJP   Moderators   -  Reputation: 10816

Like
1Likes
Like

Posted 14 August 2013 - 12:37 PM

 

Are you creating your device with the D3D11_CREATE_DEVICE_DEBUG flag and checking for warnings/errors in your debugger output? It's possible that you messed something up when creating the sampler state, and that's screwing up the shader.

 

I donot have D3D11_CREATE_DEVICE_DEBUG flag.

 

 

You should always, always, *always* be using it for debug builds. Always.



#8 xlope01   Members   -  Reputation: 173

Like
0Likes
Like

Posted 14 August 2013 - 04:13 PM

 

 

Are you creating your device with the D3D11_CREATE_DEVICE_DEBUG flag and checking for warnings/errors in your debugger output? It's possible that you messed something up when creating the sampler state, and that's screwing up the shader.

 

I donot have D3D11_CREATE_DEVICE_DEBUG flag.

 

 

You should always, always, *always* be using it for debug builds. Always.

 

only if i knew how to use this debug thing



#9 MJP   Moderators   -  Reputation: 10816

Like
0Likes
Like

Posted 14 August 2013 - 05:04 PM

It's passed to D3D11CreateDevice, through the Flags parameter.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS